httplib\urllib attributes problem

Jordan Krushen jordan at
Mon Jul 21 09:45:19 CEST 2003

On Sun, 20 Jul 2003 21:28:54 +0200, Bobbie <lorenb2 at> wrote:

> The problem with urllib2 is that a "User-agent: Python-urllib/2.0a1" is, 
> again, sent
> by default. in case I setup a "User-Agent" attribute of my own it just, 
> again, sends
> them both. Note the lower-case 'a' letter in the former user-agent
> automatically sent by the library.  I can't even overrun it because of 
> that.
> I'll be happy for any kind of help, suggestion,...

At least for this one, here's the relevant code from

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 

opener.addheaders = None


More information about the Python-list mailing list