ClientCookie bug (followup)
Mark Carter
cartermark46 at ukmail.com
Tue Aug 19 04:41:41 EDT 2003
> No really, I wasn't joking: you *never* need to use add_cookie_header
> / extract_cookies if you're using urllib2 (at least, I can't think of
> any possible reason to do so). It can only break things.
I must admit that I don't really know what I am doing. How would you
simplify the following code:
def go8():
import ClientCookie
c = ClientCookie.MSIECookieJar(delayload=1)
c.load_from_registry(username='mcarter') #only need username for
win9x
import urllib2
url = 'http://businessplus.hemscott.net/corp/crp03733.htm'
request = urllib2.Request(url)
response = urllib2.urlopen(request)
request2 = urllib2.Request(url)
c.add_cookie_header(request2)
response2 = urllib2.urlopen(request2)
print response2.geturl()
print response2.info() # headers
for line in response2.readlines(): # body
print line
More information about the Python-list
mailing list