ClientCookie bug (followup)
John J. Lee
jjl at pobox.com
Tue Aug 26 08:08:38 EDT 2003
cartermark46 at ukmail.com (Mark Carter) writes:
> jjl at pobox.com (John J. Lee) wrote in message news:<87isos0zng.fsf at pobox.com>...
> > cartermark46 at ukmail.com (Mark Carter) writes:
[...]
> I've looked again, and add_cookie_header() definitely(!) is required
> for the following code to work:
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
John
More information about the Python-list
mailing list