Overriding Libraries Problem

Bobbie lorenb2 at bezeqint.net
Mon Jul 21 02:51:24 CEST 2003


I'm doing my first python steps so forgive my Newbies' questions.
Prob is that while using urllib2 I've found out there's a default User-agent
HTTP attribute that is being added automatically.
How can I override this behaviour (preferrable from within my code) ?
I even tried to remove the relevant code directly from my library but
alas the unsolicited attribute kept showing up.
Here's the relevant code:

class OpenerDirector:
    def __init__(self):
    server_version = "Python-urllib/%s" % __version__
    self.addheaders = [('User-agent', server_version)]

I tried to comment out the last code line but in vain...

any suggestions ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030721/15d375a3/attachment.html>

More information about the Python-list mailing list