Open zajalo opened 8 years ago
Ok, I didn't even look at the source at first. Turns out, the doc on readthedocs.org is for a different version and the headers param was removed in the current version. It seems now you would have to pass in a requests.Session().
I didn't want to do it that way so I went into robobrowser.browser and added a headers param to __init__
, then simply changed this:
if user_agent is not None:
self.session.headers['User-Agent'] = user_agent
...into this:
if headers is not None:
self.session.headers.update(headers)
PS: Hats off for the nicely organized, clean code
There is user_agent
param. If you only need to set the User-Agent header, you could use:
browser = RoboBrowser(user_agent='a python robot')
@sojala I know, but I wanted to set other header values too.
This is what I get when I run this within a Flask app like this:
What could be causing this?
I installed RoboBrowser in a virtualenv using pip 7.1.2, python 2.7.10, Windows 10