Hello,
There is an error on: http://docs.python.org/howto/urllib2.html#headers
There is :
headers = { 'User-Agent' : user_agent }Maxim.
req = urllib2.Request(url, data, headers)
If you want to add header, you should use request.add_header method:
req = urllib2.Request(url, data, headers)
req.add_header('User-Agent', user_agent)