添加了两个文件

main
roger_home_pc 1 year ago
parent 711df363ad
commit a24279287f
  1. 2
      cookie.txt
  2. 18
      req.py

@ -1 +1 @@
Hm_lvt_7a3960b6f067eb0085b7f96ff5e660b0=1690080220,1690550836,1690723621,1690809059; ndut_fmt=0CB8F743B86D82140C03546BACAB8E27C63C6F0E4D04AA253D2F97753BAB5AA2; BDCLND=Kiz1b8Bpv31XBFDJNdGFjZSNEpvCREEMgiHA5oAF99k%3D; BDUSS=3dlMEhZLWtLS2tGeVh2T1ozYWtYaXdFTWV6QnRrYzByMEwzd2hWWmxkamd4dk5pRVFBQUFBJCQAAAAAAAAAAAEAAADgajfycm9nZXJzdW4wOTAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOA5zGLgOcxid; BIDUPSID=2947C9BCCF77B5D4BFC420C602BE3DF5; PSTM=1658846657; ZFY=0Vc50oTr7EmlM6WxzWE2Eewo0ltT5VQJ2KG9s8DcdoY:C; MCITY=-131%3A; STOKEN=d598c65d443486ba06db34f988e6ac8d108c6b2e4f4eae47aeec796b8c487453; BAIDUID=8DC7F291FA0638DF89C98F0178FCDC7C:FG=1; BAIDUID_BFESS=8DC7F291FA0638DF89C98F0178FCDC7C:FG=1; PANWEB=1; newlogin=1; csrfToken=AqCSBjCRMfPdDqStzGsMcX8E; PANPSC=6335470297685612817%3AKkwrx6t0uHBNjb%2BA%2BPLlBZgtJeEFa7WQw1jWL8y1tqu8ztnSQmWL1wZuq6kOUHWC2ZacVotps30YgRTDIgwTn8ZIzuhpmLh6b55KeZe4CQBn3K3RJ8ZwedL9vR6DsgcTu1tPRVPr6y7%2FwyO%2B4eG7s0I0NZhR03fFuueAr2t%2FRhNXpcvfoZtUp%2B4PuTzNr1rr; ab_sr=1.0.1_ZjdjNGYzMjAwMjdhMGQ4M2VkMTEwYzkxZTk0YzQ2YjI5ZmFjMWQwMmE4MTBiNmZmM2MyMmY0YWNiMzJkYWQyZjU5NGY2YmVjZjA4MmY3MDA2NDM5YjdjNGU2YTA1YjYxMzBjMmUwNzAxOTA2NTU1MzVmODg0YmQ0MWZlZmJhYTI3NzBlYWE4ODRiMzdmYmFhOWYwZTExMDQyMGIxYWU3ZjY0M2Y3Nzg0ZWYzOGUwNTBmMGQ5MWU2Y2Y4OGM3Y2Yy
Hm_lvt_7a3960b6f067eb0085b7f96ff5e660b0=1690080220,1690550836,1690723621,1690809059; ndut_fmt=2F3F7209152B005542DB9E27E1FE8B25A229DCC706598E1B99139109B3AD5791; BDCLND=Kiz1b8Bpv31XBFDJNdGFjZSNEpvCREEMgiHA5oAF99k%3D; BDUSS=3dlMEhZLWtLS2tGeVh2T1ozYWtYaXdFTWV6QnRrYzByMEwzd2hWWmxkamd4dk5pRVFBQUFBJCQAAAAAAAAAAAEAAADgajfycm9nZXJzdW4wOTAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOA5zGLgOcxid; BIDUPSID=2947C9BCCF77B5D4BFC420C602BE3DF5; PSTM=1658846657; ZFY=0Vc50oTr7EmlM6WxzWE2Eewo0ltT5VQJ2KG9s8DcdoY:C; MCITY=-131%3A; STOKEN=d598c65d443486ba06db34f988e6ac8d108c6b2e4f4eae47aeec796b8c487453; BAIDUID=8DC7F291FA0638DF89C98F0178FCDC7C:FG=1; BAIDUID_BFESS=8DC7F291FA0638DF89C98F0178FCDC7C:FG=1; PANWEB=1; newlogin=1; csrfToken=2r7JSCtVulGN3eOExz3JqsxP; PANPSC=12925419710669722059%3AKkwrx6t0uHBNjb%2BA%2BPLlBZgtJeEFa7WQw1jWL8y1tqu8ztnSQmWL1wZuq6kOUHWChFbm%2BExtunGiz1cJOClRr8ZIzuhpmLh6b55KeZe4CQBn3K3RJ8ZwedL9vR6DsgcTu1tPRVPr6y7%2FwyO%2B4eG7s0I0NZhR03fFuueAr2t%2FRhNXpcvfoZtUp%2B4PuTzNr1rr; ab_sr=1.0.1_NDE5NTY0NjYxYjNjZmVjZmQ2YTY1YjYzMjFlY2E5MGViZWI2MWY5MzA1Yzk4N2M1YzM3YmFlZmM2MmM1NmNmYjgzYTk4NWQxNzdiZWQxZTAzN2RlYjQ2NmI1NjAzNTAwNmJjNjNlZGFkN2JmNTUxNDMzNmRkM2RkZWVhZTZhMTM4ZjA3ZjJlMTAxYTc2MTk2YmM0YTA5OGUzMWIzNzE5Yjg0MTFkNzdjOThhMjA5ZDVhODczOTZiYzM2ZmEzZjhk

@ -46,11 +46,27 @@ class ReqAction:
}
def __init__(self):
sess = Request
# 会话配置
self.session = requests.Session()
self.bdstoken = None
def get_cookies(self):
with open('cookie.txt', 'r', encoding='utf-8') as f:
self.request_header['Cookie'] = f.readline()
@retry(stop_max_attempt_number=3, wait_fixed=1000)
def get_bdstoken(self):
url = f'{BASE_URL}/api/gettemplatevariable?clienttype=0&app_id=250528&web=1&fields=[%22bdstoken%22,%22token%22,%22uk%22,%22isdocuser%22,%22servertime%22]'
response = self.session.get(url=url, headers=self.request_header, timeout=20, allow_redirects=True,
verify=False)
print(response.text)
return response.json()['errno'] if response.json()['errno'] != 0 else response.json()['result']['bdstoken']
def main(self):
self.get_cookies()
self.bdstoken = self.get_bdstoken()
if __name__ == '__main__':
req = ReqAction()
req.main()

Loading…
Cancel
Save