Skip to content

Commit 7138530

Browse files
committed
Add library-checking process to avoid ImportError
1 parent 5efeda3 commit 7138530

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

solvedac_community/HTTPClients/__init__.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,24 @@
1414
"""
1515

1616
from .abstract_http_client import AbstractHTTPClient
17+
from .aiohttp_client import AiohttpHTTPClient
1718
from .httpclient import RequestMethod
1819
from .httpclient import ResponseData
1920
from .httpclient import Route
2021
from .httpclient import get_http_client
21-
from .aiohttp_client import AiohttpHTTPClient
22-
from .httpx_client import HttpxHTTPClient
2322

24-
__all__ = ["AbstractHTTPClient", "AiohttpHTTPClient", "HttpxHTTPClient","RequestMethod", "ResponseData", "Route", "get_http_client"]
23+
__all__ = ["AbstractHTTPClient", "RequestMethod", "ResponseData", "Route", "get_http_client"]
24+
25+
try:
26+
from .aiohttp_client import AiohttpHTTPClient
27+
28+
__all__.append("AiohttpHTTPClient")
29+
except ImportError:
30+
pass
31+
32+
try:
33+
from .httpx_client import HttpxHTTPClient
34+
35+
__all__.append("HttpxHTTPClient")
36+
except ImportError:
37+
pass

0 commit comments

Comments
 (0)