def openSession(self): uuid = AISUtil.getUUID(self.__settings) token = AISUtil.getDeviceAuthToken(self.__settings) sessionCreateReq = APCreateSessionRequest.APCreateSessionRequest( self.__settings, uuid, token) print 'create req URL: ' + sessionCreateReq.queryUrl sessionDict = sessionCreateReq.loadURL(True)
def loadURL(self): bHasUUID = AISUtil.hasUUID(self.__settings) if False == bHasUUID: # ask the identity service to generate a UUID and return it to the plugin (POST) uuidCreateReq = APUUIDCreateRequest.APUUIDCreateRequest(self.__settings) uuidDict = uuidCreateReq.loadURL(True) return uuidDict else: # open a session and continue normally self.openSession() self.prepareQueryURL() return super(APAccountLoader, self).loadURL()
def __init__(self, settings): super(APUUIDCreateRequest, self).__init__(settings) # call the parent constructor with the settings object self.queryUrl = 'https://ais-api.applicaster.com/api/v1/buckets/{{bucket_id}}/devices.json' self.queryUrl = self.queryUrl.replace('{{bucket_id}}', settings['bucketId']) self.queryUrl = self.queryUrl + '?device[device_model]=' + urllib.quote_plus(self.deviceModelValue) self.queryUrl = self.queryUrl + '&device[os_type]=android' self.queryUrl = self.queryUrl + '&device[os_version]=' + self.osVersionValue self.queryUrl = self.queryUrl + '&device[bundle_id]=' + self.bundleValue self.queryUrl = self.queryUrl + '&device[bundle_version]=' + self.bundleVersionValue # create a seed from the device ID and bundle value, used to generate a UUID by the identiity service seed = AISUtil.getUUIDSeed(settings) self.queryUrl = self.queryUrl + '&device[uuid]=' + seed
def loadURL(self): bHasUUID = AISUtil.hasUUID(self.__settings) if False == bHasUUID: # ask the identity service to generate a UUID and return it to the plugin (POST) print "asking for UUID" uuidCreateReq = APUUIDCreateRequest.APUUIDCreateRequest(self.__settings) uuidDict = uuidCreateReq.loadURL(True) for key, val in uuidDict.items(): print "key " + key + ", value: " + val return uuidDict else: # open a session and continue normally print "opening session" self.openSession() self.prepareQueryURL() return super(APAccountLoader, self).loadURL()
def __init__(self, settings): super(APUUIDCreateRequest, self).__init__( settings) # call the parent constructor with the settings object self.queryUrl = 'https://ais-api.applicaster.com/api/v1/buckets/{{bucket_id}}/devices.json' self.queryUrl = self.queryUrl.replace('{{bucket_id}}', settings['bucketId']) self.queryUrl = self.queryUrl + '?device[device_model]=' + urllib.quote_plus( self.deviceModelValue) self.queryUrl = self.queryUrl + '&device[os_type]=android' self.queryUrl = self.queryUrl + '&device[os_version]=' + self.osVersionValue self.queryUrl = self.queryUrl + '&device[bundle_id]=' + self.bundleValue self.queryUrl = self.queryUrl + '&device[bundle_version]=' + self.bundleVersionValue # create a seed from the device ID and bundle value, used to generate a UUID by the identiity service seed = AISUtil.getUUIDSeed(settings) self.queryUrl = self.queryUrl + '&device[uuid]=' + seed
def loadURL(self): bHasUUID = AISUtil.hasUUID(self.__settings) if False == bHasUUID: # ask the identity service to generate a UUID and return it to the plugin (POST) print 'asking for UUID' uuidCreateReq = APUUIDCreateRequest.APUUIDCreateRequest( self.__settings) uuidDict = uuidCreateReq.loadURL(True) for key, val in uuidDict.items(): print 'key ' + key + ', value: ' + val return uuidDict else: # open a session and continue normally print 'opening session' self.openSession() self.prepareQueryURL() return super(APAccountLoader, self).loadURL()
def openSession(self): uuid = AISUtil.getUUID(self.__settings) token = AISUtil.getDeviceAuthToken(self.__settings) sessionCreateReq = APCreateSessionRequest.APCreateSessionRequest(self.__settings, uuid, token) print "create req URL: " + sessionCreateReq.queryUrl sessionDict = sessionCreateReq.loadURL(True)