tags:

views:

70

answers:

2

Hello, everybody

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.

+1  A: 

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.

Patrick MARIE
A: 

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

facha