curl-and-python

problem sending an HTTPGET with PyCurl

From: Michael Wright <wright1michael_at_gmail.com>
Date: Tue, 15 Mar 2011 19:31:16 +0100

Hi,

I am having problems converting the following curl command into PyCurl:

curl -k --cert /tmp/blablabla "https://blablabla"

My attempt so far is shown below:

c = pycurl.Curl()
c.setopt(pycurl.URL, submit_url)
c.setopt(pycurl.HTTPGET, 1)
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.MAXREDIRS, 5)
c.setopt(pycurl.SSLCERT, cert)
c.setopt(pycurl.CAPATH,'/bla/bla/bla')
c.perform()
c.close()

This does not work. If anyone could tell me where I am going wrong that
would be great!

Cheers,

Mike

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2011-03-15