Skip to content

AttributeError: 'list' object has no attribute 'verify' when you pass in list wsse #953

@cat-turner

Description

@cat-turner

When you pass a wsse as a list to the client, like this:
client = Client(wsdl=url, transport=transport, wsse=[self.user_name_token])
or
client = Client(wsdl=url, transport=transport, wsse=[self.user_name_token, self.signature])

You get an error in the process_reply, like this:
response = client.service.RIDP(**input)
File "/Users/cathleenturner/.local/share/virtualenvs/services-m78ruPbe/lib/python3.7/site-packages/zeep/proxy.py", line 42, in call
self._op_name, args, kwargs)
File "/Users/cathleenturner/.local/share/virtualenvs/services-m78ruPbe/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 132, in send
return self.process_reply(client, operation_obj, response)
File "/Users/cathleenturner/.local/share/virtualenvs/services-m78ruPbe/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 184, in process_reply
client.wsse.verify(doc)
AttributeError: 'list' object has no attribute 'verify'

The examples refer to passing in wsse as a list.

https://python-zeep.readthedocs.io/en/master/wsse.html

>>> from zeep import Client
>>> from zeep.wsse.username import UsernameToken
>>> from zeep.wsse.signature import Signature
>>> user_name_token = UsernameToken('username', 'password')
>>> signature = Signature(private_key_filename, public_key_filename,
...     optional_password)
>>> client = Client(
...     'http://www.webservicex.net/ConvertSpeed.asmx?WSDL',
...     wsse=[user_name_token, signature])

The workaround is to not pass it as a list, like so:
client = Client(wsdl=url, transport=transport, wsse=self.user_name_token)

Would be good to get a heads up on this error in the docs before entering a rabbit hole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions