File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,10 @@ test = [
5353 " flake8-debugger==4.1.2" ,
5454 " flake8-imports==0.1.1" ,
5555]
56- async = [" httpx>=0.15.0" ]
56+ async = [
57+ " httpx>=0.15.0" ,
58+ " packaging" ,
59+ ]
5760xmlsec = [" xmlsec>=0.6.1" ]
5861
5962[build-system ]
Original file line number Diff line number Diff line change 1616except ImportError :
1717 httpx = None
1818
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
1928
2029__all__ = ["AsyncTransport" , "Transport" ]
2130
@@ -178,13 +187,15 @@ def __init__(
178187 verify_ssl = True ,
179188 proxy = None ,
180189 ):
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+ )
183195
184196 self ._close_session = False
185197 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 }
188199 self .wsdl_client = wsdl_client or httpx .Client (
189200 verify = verify_ssl ,
190201 timeout = timeout ,
You can’t perform that action at this time.
0 commit comments