curl-and-python

Re: curlpython without a file?

From: Kevin Ko <kevin.s.ko_at_gmail.com>
Date: Mon, 5 Apr 2010 19:34:48 -0400

I needed to do this last year for a project, and I wrote a patch to
add libcurl BUFFERPTR support. I'll dig it up, review it, and submit
it to the SF project page.

On Mon, Apr 5, 2010 at 7:30 PM, Brian Wawok <bwawok_at_gmail.com> wrote:
> I am trying to http post a file with cuyrlpython. I can get it to work
> like this:
>
>                    output = open("c:\\test.text", 'w')
>                    output.write(postStr)
>                    output.close()
>                    c = pycurl.Curl()
>                    c.setopt(c.POST, 1)
>                    c.setopt(c.URL, completeUrl)
>                    c.setopt(c.HTTPPOST, [("sc",  (c.FORM_FILE,
> 'c:\\test.text') )])
>
> But that is pretty silly.  I have tried various variations of
> StringIO.StringIO with no luck. How do I take my string and send it
> along as my http file?  Thanks a bunch!
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2010-04-06