subclass urllib2

Jean-Michel Pichavant jeanmichel at sequans.com
Tue Mar 1 05:19:00 EST 2011


monkeys paw wrote:
> I'm trying to subclass urllib2 in order to mask the
> version attribute. Here's what i'm using:
>
> import urllib2
>
> class myURL(urllib2):
>     def __init__(self):
>         urllib2.__init__(self)
>         self.version = 'firefox'
>
> I get this>
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
> TypeError: Error when calling the metaclass bases
> module.__init__() takes at most 2 arguments (3 given)
>
> I don't see where i am supplying 3 arguments. What am i
> missing?
>
Don't steal firefox's idendity to screen-scrap Wikipedia :p

JM



More information about the Python-list mailing list