def _login_init(self): #死方法来手动每次更新deviceid url url_info = copy.deepcopy(self._urlInfo["getDevicesId"]) url_info['url'] = self._urlInfo["getDevicesId"]['url'] + str( int(time.time() * 1000)) devices_id_rsp = EasyHttp.get_custom(url_info) # params = {"algID": request_alg_id(self._urlInfo['getJS']), "timestamp": int(time.time() * 1000)} # params = dict(params, **get_hash_code_params()) # devices_id_rsp = EasyHttp.send(self._urlInfo["getDevicesId"],params=params) if devices_id_rsp: callback = devices_id_rsp.text[18:-2] # callback = devices_id_rsp.replace("callbackFunction('", '').replace("')", '') try: text = json.loads(callback) devices_id = text.get('dfp') exp = text.get('exp') except Exception as e: return False, '获取设备指纹失败' EasyHttp.setCookies(RAIL_DEVICEID=devices_id, RAIL_EXPIRATION=exp) # Log.d('设备Id:%s'%devices_id) return True, '获取设备指纹成功' EasyHttp.send(self._urlInfo['index']) EasyHttp.send(self._urlInfo['loginInit']) return False, '获取设备指纹失败'
def _login_init(self): EasyHttp.send(self._urlInfo['loginInit']) devices_id_rsp = EasyHttp.get_custom(self._urlInfo["getDevicesId"]) if devices_id_rsp: callback = devices_id_rsp.text.replace("callbackFunction('", '').replace("')", '') text = json.loads(callback) devices_id = text.get('dfp') exp = text.get('exp') EasyHttp.setCookies(RAIL_DEVICEID=devices_id,RAIL_EXPIRATION=exp) # Log.d('设备Id:%s'%devices_id) return True,'获取设备指纹成功' return False,'获取设备指纹失败'
def _login_init(self): url_info = copy.deepcopy(self._urlInfo["getDevicesId"]) url_info['url'] = self._urlInfo["getDevicesId"]['url'] + str(int(time.time()*1000)) devices_id_rsp = EasyHttp.get_custom(url_info) if devices_id_rsp: callback = devices_id_rsp.text.replace("callbackFunction('", '').replace("')", '') text = json.loads(callback) devices_id = text.get('dfp') exp = text.get('exp') EasyHttp.setCookies(RAIL_DEVICEID=devices_id, RAIL_EXPIRATION=exp) # Log.d('设备Id:%s'%devices_id) return True, '获取设备指纹成功' EasyHttp.send(self._urlInfo['index']) EasyHttp.send(self._urlInfo['loginInit']) return False,'获取设备指纹失败'
def _login_init(self): EasyHttp.send(self._urlInfo['loginInit']) devices_id_rsp = EasyHttp.get_custom(self._urlInfo["getDevicesId"]) if devices_id_rsp: callback = devices_id_rsp.text.replace("callbackFunction('", '').replace("')", '') text = json.loads(callback) devices_id = text.get('dfp') exp = text.get('exp') EasyHttp.setCookies(RAIL_DEVICEID=devices_id, RAIL_EXPIRATION=exp) # Log.d('设备Id:%s'%devices_id) return True, '获取设备指纹成功' return False, '获取设备指纹失败' if __name__ == '__main__': # login = Login() # login.login(USER_NAME, USER_PWD) # time.sleep(3) # print(login.loginOut()) from conf.urls_conf import loginUrls devicesIdUrl = copy.deepcopy(loginUrls['normal']["getDevicesId"]) devices_id_rsp = EasyHttp.get_custom(devicesIdUrl) print(devices_id_rsp.text) text = devices_id_rsp.text.replace("callbackFunction('", '').replace("')", '') print(text) j = json.loads(text) print(j['exp']) pass