Changing the user agent for urllib

Oren Tirosh oren-py-l at hishome.net
Wed Dec 25 08:43:26 EST 2002


On Wed, Dec 25, 2002 at 04:11:39AM -0800, Fernando wrote:
> How can I make urllib.openurl() use a different user agent? I can't
> retrieve data from google with the default one

urllib.URLopener.version = "Mozilla/4.0 (compatible; Python-urllib)"

A better option would be to use the Google API:
http://diveintomark.org/projects/pygoogle/

	Oren




More information about the Python-list mailing list