FAQ

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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 22 of 37 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 14, '03 at 9:37a
activeAug 27, '03 at 11:54a
posts37
users8
websitepython.org

People

Translate

site design / logo © 2022 Grokbase