From 1ae0de87ce745c0ce5d126650cb932c2a4c31003 Mon Sep 17 00:00:00 2001 From: molanp <104612722+molanp@users.noreply.github.com> Date: Mon, 2 Jun 2025 00:56:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=80=9A=E4=B8=8D=E8=BF=87?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/utils/http_utils.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/zhenxun/utils/http_utils.py b/zhenxun/utils/http_utils.py index f31dac14..9df95112 100644 --- a/zhenxun/utils/http_utils.py +++ b/zhenxun/utils/http_utils.py @@ -37,17 +37,12 @@ def get_async_client(proxies=None, **kwargs): try: return httpx.AsyncClient(proxies=proxies, **kwargs) except TypeError: - return httpx.AsyncClient( - mounts={ - "http://": httpx.AsyncHTTPTransport(proxy=proxies.get("http")) - if proxies - else None, - "https://": httpx.AsyncHTTPTransport(proxy=proxies.get("https")) - if proxies - else None, - }, - **kwargs, - ) + return httpx.AsyncClient(mounts={ + k: v for k, v in { + "http://": httpx.AsyncHTTPTransport(proxy=proxies.get("http")) if proxies else None, + "https://": httpx.AsyncHTTPTransport(proxy=proxies.get("https")) if proxies else None + }.items() if v is not None + }, **kwargs) class AsyncHttpx: