def auth_test(self): req_data = auth.get_req_data(u'琴猪遣颠悄'.encode('utf-8'), 'xiaheibacheng18', '867323020350896-a086c68dae09') print req_data resp = 'aHLnhbKM9oBtKHz0nVBtCtRI5vdKL0kEJSj85AR8sXiImjeOMj8xF+UhTWTXBgO4XV2QitZNleNzLP34rB0uAFK09+lzAsyuAhgCwXGz5YwkQ4hpnbx8vqwX1ZGaRkE590kX4nsrDFtOFqNklC1FStEKZBNQNrTd1J1hlDqudi7sxmZgh48TLno39B+dPuhP7PpKIkO9JAdoHP9KuVyoWA==' #resp_data = auth.get_resp_data(resp) cookie = auth.get_cookie(resp) print cookie
def login_test(self): url = 'http://wlogin.m.jd.com/applogin_v2' uuid = base_data.get_random_number() + '-' + base_data.get_random_letter_number(12) print uuid data = auth.get_req_data('18445855491', 'znvd9h', uuid) req = requests.post(url, data=data, headers={'User-Agent': 'Android WJLoginSDK 1.4.2'}) resp = req.text print resp cookie = auth.get_cookie(resp) print cookie
def get_cookie(self): logger.debug('get-cookie[get_req_data]:%s %s %s' % (self.name, self.pwd, self.uuid)) url = 'http://wlogin.m.jd.com/applogin_v2' data = auth.get_req_data(self.name, self.pwd, self.uuid) headers = {'User-Agent': 'Android WJLoginSDK 2.4.0'} data = auth.get_req_data(self.name, self.pwd, self.uuid) logger.debug('POST %s\n%s\n%s' % (url, data, json.dumps(headers))) resp = requests.post(url, data=data, headers=headers) resp_text = resp.text logger.debug('resp: %s' % (resp_text)) try: cookie = auth.get_cookie(resp_text) return cookie except Exception, e: raise Exception(u'密码错误')
handler=None) if getattr(sys, 'frozen', False): app_path = os.path.dirname(sys.executable) elif __file__: app_path = os.path.dirname(__file__) config_path = os.path.join(app_path, "config.txt") config_file = open(config_path, "r+") config_data = json.load(config_file) if config_data["session_token"] == "": loginsession = auth.log_in("1.0.0") config_data["session_token"] = loginsession config_file.seek(0) json.dump(config_data, config_file) config_file.truncate() tokenn = auth.get_cookie(config_data["session_token"], "en-US", "1") config_file.close() print(tokenn) cookies = '_dnt=0; _ga=GA1.2.557708532.1591733570; _gid=GA1.2.2125084658.1591733570; _gtoken=' + str( tokenn) + ";" uheaders = { 'Host': 'web.sd.lp1.acbaa.srv.nintendo.net', 'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G965N Build/R16NW.G965NKSU1ARC7; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36', 'Referer': 'https://web.sd.lp1.acbaa.srv.nintendo.net/?lang=en-US&na_country=US&na_lang=en-US', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9',