-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_auth.py
33 lines (28 loc) · 860 Bytes
/
get_auth.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
-------------------------------------------------
FileName : get_auth.py
Time : 2023-03-14 17:35
Author : cjr
-------------------------------------------------
"""
import aiohttp
import asyncio
async def get_auth(cookies):
kwargs = {}
kwargs['url'] = f'https://www.bing.com/turing/conversation/create'
# kwargs['url'] = f'https://www.baidu.com'
kwargs['timeout'] = 30
kwargs['cookies'] = cookies
async with aiohttp.ClientSession() as client:
try:
response = await client.get(**kwargs)
if response.status == 200:
text = await response.text()
return 200, text
else:
return 404, ''
except Exception as ex:
return 500, ex
if __name__ == '__main__':
ret = asyncio.run(get_auth())
print(ret)