Skip to content

Commit ca4cbb4

Browse files
committed
Restore original httpx import behavior
1 parent dd75093 commit ca4cbb4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

ipfshttpclient/http.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@
1919

2020
PREFER_HTTPX = (os.environ.get("PY_IPFS_HTTP_CLIENT_PREFER_HTTPX", "no").lower()
2121
not in ("0", "f", "false", "n", "no"))
22-
#if PREFER_HTTPX: # pragma: http-backend=httpx
23-
# from . import http_httpx as _backend
24-
#else: # pragma: http-backend=requests
25-
# try:
26-
# from . import http_requests as _backend # type: ignore[no-redef]
27-
# except ImportError: # pragma: no cover
28-
# from . import http_httpx as _backend
29-
30-
from . import http_requests as _backend
22+
if PREFER_HTTPX: # pragma: http-backend=httpx
23+
try: #PY36+
24+
from . import http_httpx as _backend
25+
except (ImportError, SyntaxError): #PY35
26+
from . import http_requests as _backend # type: ignore[no-redef]
27+
else: # pragma: http-backend=requests
28+
try:
29+
from . import http_requests as _backend # type: ignore[no-redef]
30+
except ImportError: # pragma: no cover
31+
from . import http_httpx as _backend
3132

3233
ClientSync = _backend.ClientSync

0 commit comments

Comments
 (0)