From 7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Wed, 3 Jan 2018 15:36:50 +0100 Subject: 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. --- stdnum/util.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'stdnum/util.py') 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] -- cgit v1.2.3