Python-zeep: Documentation does not precise that User-Agent is overwritten by Transport

Created on 16 Jan 2019  路  4Comments  路  Source: mvantellingen/python-zeep

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 ?

componentransport

Most helpful comment

Yeah this should be fixed

All 4 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

orzilca picture orzilca  路  6Comments

ryan-mccaffrey picture ryan-mccaffrey  路  5Comments

ameenaskar picture ameenaskar  路  4Comments

majackson picture majackson  路  6Comments

vadivelkindhealth picture vadivelkindhealth  路  3Comments