Overriding Libraries Problem

Bobbie lorenb2 at bezeqint.net
Sun Jul 20 20:51:24 EDT 2003


Hello,

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 ?
thx
B.

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