ClientCookie bug (followup)
John J. Lee
jjl at pobox.com
Tue Aug 26 16:19:01 EDT 2003
cartermark46 at ukmail.com (Mark Carter) writes:
[...]
> 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
[...]
D'Oh!
def go10():
#works with win xp
import ClientCookie
c = ClientCookie.MSIECookieJar(delayload=1)
c.load_from_registry(username='mcarter') #only need username for win9x
opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(c))
url = 'http://businessplus.hemscott.net/corp/crp03733.htm'
response = opener.open(url)
print response.info() # headers
print response.read() # body
All of this is explained in the web page, though. [attempts to looks
at web page] Well, it would be if the link weren't broken or I could
log in to my SF account to fix it... Sigh.
BTW, if you want to use ClientCookie.urlopen rather than opener.open,
you can call ClientCookie.install_opener(opener) to install a global
opener, just as you would with urllib2.
John
More information about the Python-list
mailing list