If you wish to set custom headers for a request, you can simply create a mechanize.Request object and pass it a headers dictionary. Then pass the request object to browser.open() instead of the URL.
The user agent is set when the browser object is created in get_browser(). You can see it by simply printing out browser.addheaders
|