The documentation explains here https://python-zeep.readthedocs.io/en/master/transport.html
that you can provide your own Session object in order to customize things
However one thing can't be currently customized this way: the User-Agent
as the line :
https://github.com/mvantellingen/python-zeep/blob/master/src/zeep/transports.py#L31-L32
self.session = session or requests.Session()
self.session.headers['User-Agent'] = (
'Zeep/%s (www.python-zeep.org)' % (get_version()))
will overwrite it regardless of where it comes
I don't have a clean fix for this , as default Session object also come with an already set User-Agent string, so one can not just check for the existence of this header or not. My shot on this would be to put a warning/note in the documentation about it ?
my current workaround is to set the user-agent after the transport was created using
transport.session.headers['User-Agent'] = "the string I want"
Yeah this should be fixed
Yeah if the session is supplied then I don't think zeep should modify it.
Hi,
Any plan by when this issue will be fixed?
Thanks
Jose M. Prieto
Most helpful comment
Yeah this should be fixed