File tree 2 files changed +19
-5
lines changed
2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,10 @@ test = [
53
53
" flake8-debugger==4.1.2" ,
54
54
" flake8-imports==0.1.1" ,
55
55
]
56
- async = [" httpx>=0.15.0" ]
56
+ async = [
57
+ " httpx>=0.15.0" ,
58
+ " packaging" ,
59
+ ]
57
60
xmlsec = [" xmlsec>=0.6.1" ]
58
61
59
62
[build-system ]
Original file line number Diff line number Diff line change 16
16
except ImportError :
17
17
httpx = None
18
18
19
+ try :
20
+ from packaging .version import Version
21
+ if Version (httpx .__version__ ) >= Version ("0.26.0" ):
22
+ HTTPX_PROXY_KWARG_NAME = "proxy"
23
+ else :
24
+ HTTPX_PROXY_KWARG_NAME = "proxies"
25
+ except ImportError :
26
+ Version = None
27
+ HTTPX_PROXY_KWARG_NAME = None
19
28
20
29
__all__ = ["AsyncTransport" , "Transport" ]
21
30
@@ -178,13 +187,15 @@ def __init__(
178
187
verify_ssl = True ,
179
188
proxy = None ,
180
189
):
181
- if httpx is None :
182
- raise RuntimeError ("The AsyncTransport is based on the httpx module" )
190
+ if httpx is None or HTTPX_PROXY_KWARG_NAME is None :
191
+ raise RuntimeError (
192
+ "To use AsyncTransport, install zeep with the async extras, "
193
+ "e.g., `pip install zeep[async]`"
194
+ )
183
195
184
196
self ._close_session = False
185
197
self .cache = cache
186
- proxy_kwarg_name = "proxy" if httpx .__version__ >= "0.26.0" else "proxies"
187
- proxy_kwargs = {proxy_kwarg_name : proxy }
198
+ proxy_kwargs = {HTTPX_PROXY_KWARG_NAME : proxy }
188
199
self .wsdl_client = wsdl_client or httpx .Client (
189
200
verify = verify_ssl ,
190
201
timeout = timeout ,
You can’t perform that action at this time.
0 commit comments