urllib - changing the user agent

John J. Lee jjl at pobox.com
Fri Jan 9 15:12:56 CET 2004

michael at foord.net (Fuzzyman) writes:
> I'm using urllib (for the first time)..... and google don't seem very
> keen to let me search the group from within a program - the returned
> pages all tell me 'you're not allowed to do that' :-)

Don't do it, then.  Use the google API (mind you, not certain that
google groups is part of that).

> Could anyone tell me how to subclass this correctly with the version
> attribute set and what text string I should use to mimic Internet
> explorer and/or mozilla ?


opener.addheaders = [("User-agent", "whatever")]

Use a program like ethereal to find what your browser sends for


More information about the Python-list mailing list