def startNewSession(connection): ''' This method is used to create and start a new session. It will return the url of the newly created session Args: - connection is the connection object that manages the HTTP data transfers between the client and the REST API ''' sessionsUrl = "sessions" startNewSessionUrl = "%s/operations/startNewSession" % (sessionsUrl) startNewSessionReply = performGenericOperation(connection, startNewSessionUrl, {}) sessionLocation = stripApiAndVersionFromURL(startNewSessionReply.headers['location']) resourceObj = connection.httpGet(sessionLocation) sessionId = resourceObj.sessionId log("Created session no %s" % sessionId) newSessionUrl = "%s/%s" % (sessionsUrl, sessionId) return newSessionUrl