(self)
data = {"timestamp": int(time.time()),
                "nonce": "%d_%d" % (int(time.time()), random.randint(0, 2147483647)),
                "oauth_token": response.get('sessionInfo', {}).get('sessionToken', ''),
                "targetEnv": "mobile"}
data = {"timestamp": int(time.time()),
                "nonce": "%d_%d" % (int(time.time()), random.randint(0, 2147483647)),
                "oauth_token": response.get('sessionInfo', {}).get('sessionToken', ''),
                "targetEnv": "mobile"}
data = { timestamp : int ( time . time () ) nonce : %d_%d % ( int ( time . time () ) random . randint ( 0 2147483647 )) oauth_token : response . get ( sessionInfo {} ) . get ( sessionToken ) targetEnv : mobile }
def login(self):
        r = requests.get("https://disc-prod.iot.irobotapi.com/v1/discover/endpoints?country_code=US")
        response = r.json()
        deployment = response['deployments'][next(iter(response['deployments']))]
        self.httpBase = deployment['httpBase']
        iotBase = deployment['httpBaseAuth']
        iotUrl = urllib.parse.urlparse(iotBase)
        self.iotHost = iotUrl.netloc
        region = deployment['awsRegion']

        self.apikey = response['gigya']['api_key']
        self.gigyaBase = response['gigya']['datacenter_domain']

        data = {"apiKey": self.apikey,
                "targetenv": "mobile",
                "loginID": self.username,
                "password": self.password,
                "format": "json",
                "targetEnv": "mobile",
        }

        r = requests.post("https://accounts.%s/accounts.login" % self.gigyaBase, data=data)

        response = r.json()
        '''
        data = {"timestamp": int(time.time()),
                "nonce": "%d_%d" % (int(time.time()), random.randint(0, 2147483647)),
                "oauth_token": response.get('sessionInfo', {}).get('sessionToken', ''),
                "targetEnv": "mobile"}
        '''
        uid = response['UID']
        uidSig = response['UIDSignature']
        sigTime = response['signatureTimestamp']

        data = {
            "app_id": "ANDROID-C7FB240E-DF34-42D7-AE4E-A8C17079A294",
            "assume_robot_ownership": "0",
            "gigya": {
                "signature": uidSig,
                "timestamp": sigTime,
                "uid": uid,
            }
        }

        r = requests.post("%s/v2/login" % self.httpBase, json=data)

        response = r.json()
        access_key = response['credentials']['AccessKeyId']
        secret_key = response['credentials']['SecretKey']
        session_token = response['credentials']['SessionToken']

        self.data = response

        self.amz = awsRequest(region, access_key, secret_key, session_token, "execute-api")
def login ( self ) : r = requests . get ( "https://disc-prod.iot.irobotapi.com/v1/discover/endpoints?country_code=US" ) response = r . json ( ) deployment = response [ 'deployments' ] [ next ( iter ( response [ 'deployments' ] ) ) ] self . httpBase = deployment [ 'httpBase' ] iotBase = deployment [ 'httpBaseAuth' ] iotUrl = urllib . parse . urlparse ( iotBase ) self . iotHost = iotUrl . netloc region = deployment [ 'awsRegion' ] self . apikey = response [ 'gigya' ] [ 'api_key' ] self . gigyaBase = response [ 'gigya' ] [ 'datacenter_domain' ] data = { "apiKey" : self . apikey , "targetenv" : "mobile" , "loginID" : self . username , "password" : self . password , "format" : "json" , "targetEnv" : "mobile" , } r = requests . post ( "https://accounts.%s/accounts.login" % self . gigyaBase , data = data ) response = r . json ( ) uid = response [ 'UID' ] uidSig = response [ 'UIDSignature' ] sigTime = response [ 'signatureTimestamp' ] data = { "app_id" : "ANDROID-C7FB240E-DF34-42D7-AE4E-A8C17079A294" , "assume_robot_ownership" : "0" , "gigya" : { "signature" : uidSig , "timestamp" : sigTime , "uid" : uid , } } r = requests . post ( "%s/v2/login" % self . httpBase , json = data ) response = r . json ( ) access_key = response [ 'credentials' ] [ 'AccessKeyId' ] secret_key = response [ 'credentials' ] [ 'SecretKey' ] session_token = response [ 'credentials' ] [ 'SessionToken' ] self . data = response self . amz = awsRequest ( region , access_key , secret_key , session_token , "execute-api" )