1

I'm using the following piece of code to get the content of a webpage from python script:

#!/usr/bin/env python
import pycurl
import StringIO

c = pycurl.Curl()
c.setopt(pycurl.URL, "http://google.com")
b = StringIO.StringIO()
c.setopt( c.WRITEFUNCTION, b.write)
#c.setopt(pycurl.COOKIESESSION, True);
c.setopt(pycurl.COOKIEFILE, "/tmp/cookiefile.txt");
c.setopt(pycurl.COOKIEJAR, "/tmp/cookiefile.txt");
c.perform()
page_data = b.getvalue()

For some reason

c.setopt(pycurl.COOKIESESSION, True);

gives an error. Does anybody know if this option is supported in pycurl?

Thanks in advance.

3 Answers 3

2

I'm sorry but this option is not supported in pycurl, but as I can see in the source code, it should be a fairly easy fix. You should ask for it on the curl and python mailing list.

2

This fixes the Problem:

import pycurl
pycurl.COOKIESESSION = 96
0

I guess removing the cookiefile will have the same effect as setting COOKIESESSION to True.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.