Currently, I'm using mechanize like this:
browser = mechanize.Browser()
browser.set_handle_robots(False)
browser.set_handle_equiv(False)
browser.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
However, operating systems and browsers get updated and I assume that this header: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1
should be updated as well.
Is there any template, method of building such header string? Where can I find the newest available values to build such header?
Why do you need always the newest Useragent in your Fake-Header? Sites will not block you for using an older browser in most cases. So it would be sufficient to update from time to time (or not at all. Often its enough to add "Mozilla" to the front of the UA-string to get a response as a browser gets).
Another answer would be if you have a webserver running, get some random (non-bot) string from your http-logs.
Visit http://www.useragentstring.com/pages/useragentstring.php for a list of current browser User-Agent strings. It can also automatically detect and explain your current browser's User-Agent details if you click on
home
.You may also paste User-Agent strings to have them explained to you.
I had your same question in mind and stumbled upon that website just now. I got there by googling a User-Agent string,
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1'
.Happy coding!