Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 518
Lori M Avatar asked Feb 06 '23 19:02

Lori M


2 Answers

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

like image 88
mvantellingen Avatar answered Feb 09 '23 11:02

mvantellingen


this one works just fine

client.transport.session.headers.update({'yourHeader': 'yourValue'})
like image 29
maqszur Avatar answered Feb 09 '23 11:02

maqszur