def startSession(sessionId, instant): "Starts the session" data = '{"instant":"' + formatDatetime(instant) + '"}' url = SessionsUrl + '/' + str(sessionId) + '/start' post(data, url) print("Start the session " + str(sessionId)) return
def addSession(name, start, end, sessionType): "This adds a Session" data = '{"type":"' + sessionType + '", "name":"' + name + '", "start":"' + formatDatetime( start) + '", "end":"' + formatDatetime(end) + '"}' post(data, SessionsUrl) print("Session " + name + " added") sessionResponse = getSessionByName(name) return sessionResponse
def endSession(sessionId, instant): "Ends the session" date = formatDatetime(instant) data = '{"instant":"' + date + '"}' url = SessionsUrl + '/' + str(sessionId) + '/end' post(data, url) print("End the session " + str(sessionId) + " @ " + date) return
def addPilotToSession(sessionId, pilotId): "Associate Session and Chrono" url = SessionsUrl + '/' + str(sessionId) + '/addPilot?pilotId=' + str( pilotId) post('', url) print("Associate Session id " + str(sessionId) + " and pilot id " + str(pilotId)) return
def addChronometerToSession(sessionId, chronoId, index=-1): "Associate Session and Chrono" url = SessionsUrl + '/' + str( sessionId) + '/addChronometer?chronoId=' + str(chronoId) if index >= 0: url = url + '&index=' + str(index) post('', url) print("Associate Session id " + str(sessionId) + " and chrono id " + str(chronoId)) return