On Fri, Jan 23, 2009 at 11:25 AM, Andre Engels <andreeng...@gmail.com> wrote:

> In the __init__ of the class URLopener, add the following at the end:
>
> self.addheaders = [header for header in self.addheaders if header[0]
> != "User-Agent"] + [('User-Agent', '<whatever>')]
>
> (probably
>
> self.addheaders = [('User-Agent', '<whatever>')]
>
> does the same, but my version is more secure)

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>'


-- 
André Engels, andreeng...@gmail.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to