Lori M
Lori M

Reputation: 63

setting username and password in the http header for a SOAP request message using zeep (python)?

How can you set the username and password in the http header for a SOAP request message using python's zeep? I believe that is why i am getting a connection refused error but cannot figure out where the http header details can be set. I even tried just running python -mzeep on the wsdl file (vs creating a client and calling a web service method) but it still cannot connect.

Upvotes: 5

Views: 5145

Answers (2)

maqszur
maqszur

Reputation: 86

this one works just fine

client.transport.session.headers.update({'yourHeader': 'yourValue'})

Upvotes: 2

mvantellingen
mvantellingen

Reputation: 1259

Zeep uses the requests library for http requests. The request session is available as client.transport.session.

So doing something like client.transport.session.headers.update({}) should work. See http://docs.python-requests.org/en/master/user/advanced/#session-objects

Upvotes: 8

Related Questions