mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
🚑 修复代理设置问题
This commit is contained in:
parent
10e883f0ca
commit
bd0e335ed1
@ -34,14 +34,11 @@ def get_async_client(
|
|||||||
if proxies:
|
if proxies:
|
||||||
http_proxy = proxies.get("http://")
|
http_proxy = proxies.get("http://")
|
||||||
https_proxy = proxies.get("https://")
|
https_proxy = proxies.get("https://")
|
||||||
transport_kwargs = {}
|
|
||||||
if http_proxy:
|
|
||||||
transport_kwargs["http"] = http_proxy
|
|
||||||
if https_proxy:
|
|
||||||
transport_kwargs["https"] = https_proxy
|
|
||||||
proxy_transport = AsyncHTTPTransport(**transport_kwargs)
|
|
||||||
return httpx.AsyncClient(
|
return httpx.AsyncClient(
|
||||||
mounts={"http://": proxy_transport, "https://": proxy_transport},
|
mounts={
|
||||||
|
"http://": AsyncHTTPTransport(proxy=http_proxy),
|
||||||
|
"https://": AsyncHTTPTransport(proxy=https_proxy),
|
||||||
|
},
|
||||||
transport=transport,
|
transport=transport,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user