What am I trying to do?
Visit a site, retrieve cookie, visit the next page by sending in the cookie info. It all works but httplib2 is giving me one too many problems with socks proxy on one site.
http = httplib2.Http()
main_url = 'http://mywebsite.com/get.aspx?id='+ id +'&rows=25'
response, content = http.request(main_url, 'GET', headers=headers)
main_cookie = response['set-cookie']
referer = 'http://google.com'
headers = {'Content-type': 'application/x-www-form-urlencoded', 'Cookie': main_cookie, 'User-Agent' : USER_AGENT, 'Referer' : referer}
How to do the same exact thing using urllib2 (cookie retrieving, passing to the next page on the same site)?
Thank you.
Use cookielib, it’ll handle all the cookie related work as automatically as a web browser would.
Example: