File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from collections .abc import Coroutine
66from tempfile import TemporaryDirectory
77from shutil import copy
8- from weakref import WeakSet
98
109from httpx import AsyncClient , Client , Response , TimeoutException
1110from aiofile import async_open
1211
1312from app .core import settings , logger
14- from app .utils .url import URLUtils
1513from app .utils .retry import Retry
1614
1715
@@ -340,28 +338,17 @@ class RequestUtils:
340338 支持同步和异步请求
341339 """
342340
343- __clients : dict [str , HTTPClient ] = {}
344- __client_list : WeakSet [HTTPClient ] = WeakSet ()
341+ __client = HTTPClient
345342
346343 @classmethod
347- def get_client (cls , url : str = "" ) -> HTTPClient :
344+ def get_client (cls , * _ , ** __ ) -> HTTPClient :
348345 """
349346 获取 HTTP 客户端
350347
351348 :param url: 请求的 URL
352349 :return: HTTP 客户端
353350 """
354-
355- if url :
356- _ , domain , port = URLUtils .get_resolve_url (url )
357- key = f"{ domain } :{ port } "
358- if key not in cls .__clients :
359- cls .__clients [key ] = HTTPClient ()
360- return cls .__clients [key ]
361-
362- client = HTTPClient ()
363- cls .__client_list .add (client )
364- return client
351+ return cls .client
365352
366353 @overload
367354 @classmethod
You can’t perform that action at this time.
0 commit comments