ClientCookie bug (followup)

Mark Carter cartermark46 at ukmail.com
Tue Aug 26 13:50:03 EDT 2003


> Oh, sorry, I missed something: you're using urllib.urlopen.  You need
> to call ClientCookie.urlopen instead (this is still using urllib2 --
> ClientCookie uses urllib2 to do most of the work).
> 
> You seem to be opening the same URL twice for no obvious reason, so I
> removed that below:
> 
> 
> def go10():
>     #works with win xp
>     import ClientCookie
>     c = ClientCookie.MSIECookieJar(delayload=1)
>     c.load_from_registry(username='mcarter') #only need username for win9x
> 
>     url = 'http://businessplus.hemscott.net/corp/crp03733.htm'
>     response = ClientCookie.urlopen(url)
> 
>     print response.info()  # headers
>     print response.read()  # body


At the risk of sounding thick ... this doesn't work either! I couldn't
get load_cookie_data() to work using the above template, either. What
seems odd for starters is the line
response = ClientCookie.urlopen(url)

What makes it odd is that to an offhand observer, there is nothing
visibly connecting the urlopen() command to c. Sure, some fancy stuff
may be going on under the hood; but like I say, ClientCookie.urlopen()
doesn't seem connected with the MSIECookieJar instance just by looking
at it. It looks like I really want to be saying something like
response = c.urlopen(url)
but that just gives me
AttributeError: MSIECookieJar instance has no attribute 'urlopen'




More information about the Python-list mailing list