Overriding Libraries Problem

Discussion in 'Python' started by Bobbie, Jul 21, 2003.

  1. Bobbie

    Bobbie Guest

    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.
     
    Bobbie, Jul 21, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Evans

    overriding object.clone() problem

    Jason Evans, May 24, 2004, in forum: Java
    Replies:
    2
    Views:
    536
    Michael Borgwardt
    May 24, 2004
  2. Gerald Rosenberg
    Replies:
    2
    Views:
    435
    Gerald Rosenberg
    Sep 4, 2005
  3. AGoTH
    Replies:
    7
    Views:
    480
    Jerry Coffin
    Aug 10, 2003
  4. Karsten Wutzke
    Replies:
    21
    Views:
    926
    Roedy Green
    Jun 29, 2007
  5. Sriram Srinivasan
    Replies:
    13
    Views:
    576
    Benjamin Kaplan
    Nov 12, 2009
Loading...

Share This Page