httplib\urllib attributes problem
Bobbie
lorenb2 at bezeqint.net
Sun Jul 20 17:28:38 EDT 2003
thanks.
question: why can't I just totally erase that "self.addheaders = " line ?
B.
----- Original Message -----
From: "Jordan Krushen" <jordan at krushen.com>
Newsgroups: comp.lang.python
To: <python-list at python.org>
Sent: Monday, July 21, 2003 9:48 AM
Subject: Re: httplib\urllib attributes problem
> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list