[Tutor] fetching wikipedia articles
Kent Johnson
kent37 at tds.net
Fri Jan 23 13:29:28 CET 2009
On Fri, Jan 23, 2009 at 5:37 AM, Andre Engels <andreengels at gmail.com> wrote:
> Looking further I found that a 'cleaner' way to make the same change
> is to add to the code of URLopener (outside any method):
>
> version = '<whatever>'
You can do this without modifying the standard library source, by
import urllib
urllib.URLopener.version = '<whatever>'
The version string is used as the User-Agent, that is why this works at all.
Kent
More information about the Tutor
mailing list