mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update http_utils.py
This commit is contained in:
parent
c8a7d855f8
commit
d4ec0df00c
@ -51,7 +51,7 @@ class AsyncHttpx:
|
|||||||
if not headers:
|
if not headers:
|
||||||
headers = get_user_agent()
|
headers = get_user_agent()
|
||||||
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
||||||
async with httpx.AsyncClient(proxies=proxy,verify=verify) as client:
|
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
|
||||||
return await client.get(
|
return await client.get(
|
||||||
url,
|
url,
|
||||||
params=params,
|
params=params,
|
||||||
@ -98,7 +98,7 @@ class AsyncHttpx:
|
|||||||
if not headers:
|
if not headers:
|
||||||
headers = get_user_agent()
|
headers = get_user_agent()
|
||||||
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
||||||
async with httpx.AsyncClient(proxies=proxy,verify=verify) as client:
|
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
|
||||||
return await client.post(
|
return await client.post(
|
||||||
url,
|
url,
|
||||||
content=content,
|
content=content,
|
||||||
@ -172,7 +172,7 @@ class AsyncHttpx:
|
|||||||
headers = get_user_agent()
|
headers = get_user_agent()
|
||||||
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
proxy = proxy if proxy else cls.proxy if use_proxy else None
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(proxies=proxy,verify=verify) as client:
|
async with httpx.AsyncClient(proxies=proxy, verify=verify) as client:
|
||||||
async with client.stream(
|
async with client.stream(
|
||||||
"GET",
|
"GET",
|
||||||
url,
|
url,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user