5

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.

fedorqui
  • 275,237
  • 103
  • 548
  • 598
Lori M
  • 63
  • 1
  • 4

2 Answers2

8

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

mvantellingen
  • 1,229
  • 10
  • 6
2

this one works just fine

client.transport.session.headers.update({'yourHeader': 'yourValue'})
maqszur
  • 86
  • 6