Overriding Libraries Problem

B

Bobbie

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top