0

I am getting an error and cannot find a way to get around it - it completely stops my progress. How can I access this API with SOAP through Python?

import zeep

endpoint_soap = 'http://api4.ibmmarketingcloud.com/SoapApi?wsdl'
client = zeep.Client(endpoint_soap)

Error I get is ValueError:

....
File "src/lxml/etree.pyx", line 1826, in lxml.etree.QName.__init__
File "src/lxml/apihelpers.pxi", line 1626, in 
lxml.etree._tagValidOrRaise
ValueError: Invalid tag name 'AGGREGATE_SUPPRESSIONS '

Python 3.6

jan-seins
  • 1,253
  • 1
  • 18
  • 31
Scott Stoltzman
  • 363
  • 1
  • 15
  • here someone had the same problem https://github.com/mvantellingen/python-zeep/issues/594 - this is probably not a zeep but a lxml problem – jan-seins May 07 '18 at 09:48
  • Thank you @jan-seins https://github.com/mvantellingen/python-zeep/issues/594 solved the problem at the bottom. Have to modify the zeep utils.py as discussed in the issue – Scott Stoltzman May 09 '18 at 16:15

1 Answers1

1

The problem is the white space in the tag name 'AGGREGATE_SUPPRESSIONS ' - so you have to modify the utils.py file within the library itself. It's a simple fix which a workaround was presented on GitHub issue:

https://github.com/mvantellingen/python-zeep/issues/594

Add the following lines of code at the very beginning of the as_qname function.

Within zeep > utils.py :

def as_qname(value, nsmap, target_namespace=None):
    ## Workaround: if any leading and/or ending whitespaces are present, remove them
    ## strip whitespaces
    value = value.strip()
    ## End of workaround
Scott Stoltzman
  • 363
  • 1
  • 15