httplib\urllib attributes problem
Jordan Krushen
jordan at krushen.com
Mon Jul 21 03:48:41 EDT 2003
On Mon, 21 Jul 2003 07:45:19 GMT, Jordan Krushen <jordan at krushen.com>
wrote:
> At least for this one, here's the relevant code from urllib2.py:
>
> class OpenerDirector:
> def __init__(self):
> server_version = "Python-urllib/%s" % __version__
> self.addheaders = [('User-agent', server_version)]
>
> You should be able to override your opener's addheaders attribute
> (untested):
>
> opener.addheaders = None
Actually, it's late. Use this instead:
opener.addheaders = []
This won't break if something else tries to append to the list.
J.
More information about the Python-list
mailing list