Changing the user-agent in urllib

Inigo Serna inigoserna at gmail.com
Sun Jul 8 15:56:58 EDT 2007


On Sun, Jul 08, 2007 at 12:21:38PM -0700, James Matthews wrote:
> Is there anyway of changing the user-agent in urllib without sub classing
> it?

Yes,

>>> import urllib
>>> urllib.URLopener.version = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; T312461)'

Regards,
I�igo Serna



More information about the Python-list mailing list