diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2018-01-03 15:36:50 +0100 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2018-01-03 15:47:49 +0100 |
commit | 7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f (patch) | |
tree | 823fb369dad096e3128b2502430512d3d4826c1b /stdnum/util.py | |
parent | 6d7ba46f9e15d19a5519a9960f90904b0bbcac0f (diff) |
Try the non-caching zeep client on older versions
This uses the "normal" Client class from zeep if CachingClient is not
available (this is the case on older zeep versions).
This also records (and documents) the dependencies for SOAP libraries in
setup.py.
Diffstat (limited to 'stdnum/util.py')
-rw-r--r-- | stdnum/util.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/stdnum/util.py b/stdnum/util.py index 698a22e..3a48729 100644 --- a/stdnum/util.py +++ b/stdnum/util.py @@ -178,22 +178,28 @@ def get_soap_client(wsdlurl): # pragma: no cover (not part of normal test suite # this function isn't automatically tested because the functions using # it are not automatically tested if wsdlurl not in _soap_clients: - try: - from urllib import getproxies - except ImportError: - from urllib.request import getproxies # try zeep first try: from zeep import CachingClient client = CachingClient(wsdlurl).service except ImportError: - # fall back to suds + # fall back to non-caching zeep client try: - from suds.client import Client - client = Client(wsdlurl, proxy=getproxies()).service + from zeep import Client + client = Client(wsdlurl).service except ImportError: - # use pysimplesoap as last resort - from pysimplesoap.client import SoapClient - client = SoapClient(wsdl=wsdlurl, proxy=getproxies()) + # other implementations require passing the proxy config + try: + from urllib import getproxies + except ImportError: + from urllib.request import getproxies + # fall back to suds + try: + from suds.client import Client + client = Client(wsdlurl, proxy=getproxies()).service + except ImportError: + # use pysimplesoap as last resort + from pysimplesoap.client import SoapClient + client = SoapClient(wsdl=wsdlurl, proxy=getproxies()) _soap_clients[wsdlurl] = client return _soap_clients[wsdlurl] |