curl-and-python

Re: problem sending an HTTPGET with PyCurl

From: Michael Wright <wright1michael_at_gmail.com>
Date: Thu, 31 Mar 2011 15:09:21 +0200

Hi Maciej,

Thanks for the reply. The example below works fine. The url I set was wrong
and I needed a fresh pair of eyes to see where I went wrong.

The basis of the code is to make a change to a servers conditions by using a
HTTP GET. I also needed to send my certificate to give me permission to do
so.

Cheers,

Mike

2011/3/31 Maciej Bliziński <maciej.blizinski_at_gmail.com>

> 2011/3/15 Michael Wright <wright1michael_at_gmail.com>
> > 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!
>
> It would help to know what exactly did go wrong in your example, i.e.
> what did you expect to happen, and what happened.
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

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