This applies to pycurl 7.19.0 and adds support for libcurl's BUFFER and BUFFERPTR form parameters, which allow one to use a string as a POST parameter.
params = [
('x', (pycurl.FORM_BUFFER, "filename", pycurl.FORM_BUFFERPTR, "data"))
c = pycurl.Curl()
Excerpt from libcurl's API:
is used in combination with CURLFORM_BUFFER. The parameter is a pointer to the buffer to be uploaded. This buffer must not be freed until after curl_easy_cleanup(3) is called. You must also use CURLFORM_BUFFERLENGTH to set the number of bytes in the buffer.
Although the API docs say that the buffer should not be freed until curl_easy_cleanup() is called, I followed the liveness of CurlObject.httppost within pycurl.c, since the API makes identical assumptions.
Please direct comments to kevin.s.ko at gmail dot com.