python - how do I get pycurl to send cookies but not save them to file? -


i need pycurl save cookies posted form , use cookies in next url in same domain. doesn't seem automatically.

ive read cookiefile , cookiejar options dont want save these cookies file. there other way of enabling cookies curl/pycurl without saving them file?

well libcurl docs states that:

curlopt_cookiefile

given empty or non-existing file or passing empty string (""), option enable cookies curl handle, making understand , parse received cookies , use matching cookies in future requests.

just tried myself , works brilliantly, use same curl object.

example

import pycurl curl = pycurl.curl()  # turn on cookies curl.setopt(pycurl.cookiefile, "")  # login curl.setopt(pycurl.url, "http://www.example.com/login.php") curl.setopt(pycurl.post, 1) curl.setopt(pycurl.httppost, [('user', 'myuser'), ('pass', 'mypass'), ('submit', 'login')]) curl.perform()  # let's members page curl.setopt(pycurl.post, 0)  curl.setopt(pycurl.url, "http://www.example.com/members_only.php") curl.perform() 

i skipped whole stringio response getting stay ontopic.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -