[docs] http://docs.python.org/howto/urllib2.html#headers - error

Maxim Boyarskiy mboyarskiy at thumbtack.net
Fri Jul 27 11:16:18 CEST 2012


There is an error on: http://docs.python.org/howto/urllib2.html#headers

There is :

headers = { 'User-Agent' : user_agent }
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**)*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20120727/19c0ef63/attachment.html>

More information about the docs mailing list