lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.7-28-g7bb0e5f

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.7-28-g7bb0e5f



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f (commit)
      from  6d7ba46f9e15d19a5519a9960f90904b0bbcac0f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f

commit 7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Wed Jan 3 15:36:50 2018 +0100

    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.

diff --git a/setup.py b/setup.py
index c47808e..743399a 100755
--- a/setup.py
+++ b/setup.py
@@ -68,7 +68,11 @@ setup(name='python-stdnum',
       packages=find_packages(),
       package_data={'': ['*.dat']},
       extras_require={
-          'VIES':  ['suds'],
-          'VIES-ALT':  ['PySimpleSOAP'],
+          # The SOAP feature is only required for a number of online tests
+          # of numbers such as the EU VAT VIES lookup, the Dominican Republic
+          # DGII services or the Turkish T.C. Kimlik validation.
+          'SOAP':  ['zeep'],     # recommended implementation
+          'SOAP-ALT': ['suds'],  # but this should also work
+          'SOAP-FALLBACK':  ['PySimpleSOAP'],  # this is a fallback
           },
       )
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]

-----------------------------------------------------------------------

Summary of changes:
 setup.py       |  8 ++++++--
 stdnum/util.py | 26 ++++++++++++++++----------
 2 files changed, 22 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
python-stdnum
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/