curl-and-python

Re: pycurl and rest PUT interface

From: Mark Seger <mjseger_at_gmail.com>
Date: Tue, 22 Jan 2013 16:54:22 -0500

cool. I just tried that but the mapping to pycurl isn't obvious to me.
 what I see is:

  CURL *hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_URL, "https://...");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1);
  curl_easy_setopt(hnd, CURLOPT_HEADER, 1);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/7.21.3
(x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4libidn/1.18");
  curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYHOST, 1);
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50);
  curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
  ret = curl_easy_perform(hnd);

I guess I was hoping for a simple option or two with which to point to a
file and say PUT, but maybe this isn't all that common of an operation?

ultimately I want to point to a string and say PUT but I'm happy to start
with something simpler.

-mark

On Tue, Jan 22, 2013 at 4:32 PM, Michael Wood <esiotrot_at_gmail.com> wrote:

> Hi
>
> On 22 January 2013 23:29, Mark Seger <mjseger_at_gmail.com> wrote:
> > thanks for the quick reply
> > I'm not sure what you're saying because when I go to the libcurl page it
> > talks about python bindings with ultimately points me back to pycurl.
> > if you're suggesting I do it in C and call libcurl, my requirement is to
> do
> > it in python so that wouldn't work
> > -mark
>
> No, he is saying that if you just append "--libcurl filename.c" to the
> end of that curl command line it will generate a C program that you
> can use as a guide for your Python program.
>
> > On Tue, Jan 22, 2013 at 4:24 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> >>
> >> On Tue, 22 Jan 2013, Mark Seger wrote:
> >>
> >>> I have an example what I want to do in curl, but don't know how to
> >>> translate this to pycurl.
> >>
> >>
> >> Try --libcurl, it makes a C program but it is very similar to what a
> >> pycurl program could look like.
> >>
> >>
> >>> curl -X PUT -k -i -H X-Auth-Token:$auth -T xyzzy ${url}/xyzzy/xyzzy
> >>
> >>
> >> -X is pointless here:
> >> http://curl.haxx.se/docs/faq.html#curl_X_gives_me_HTTP_problems
> >>
> >> --
> >>
> >> / daniel.haxx.se
> >> _______________________________________________
> >> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
> >
> >
> >
> > _______________________________________________
> > http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
> >
>
>
>
> --
> Michael Wood <esiotrot_at_gmail.com>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-01-22