🚑 修复代理设置问题

This commit is contained in:
molanp 2025-06-17 19:32:37 +08:00 committed by GitHub
parent 10e883f0ca
commit bd0e335ed1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,14 +34,11 @@ def get_async_client(
if proxies:
http_proxy = proxies.get("http://")
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(
mounts={"http://": proxy_transport, "https://": proxy_transport},
mounts={
"http://": AsyncHTTPTransport(proxy=http_proxy),
"https://": AsyncHTTPTransport(proxy=https_proxy),
},
transport=transport,
**kwargs,
)