title: is there an alternative to pycurl.FORM_FILE that takes either a string to be sent or a stream object?
body: <p>I've started using pycurl recently and am currently using the setop pycurl.FORM_FILE. But the data that i want to send is in a string, so it is weird to write a file just so the next method can read it.</p>
  
  <p>So my question is: is there an alternative to pycurl.FORM_FILE that takes either a string to be sent or a stream object (like a file object)?</p>
  
  <p>It would be simmilar to FORM_STREAM from libcurl.</p>
  
  <p>readdata and readfunction won't work for post with multi-part form.</p>
  
  <p>something like this:</p>
  
  <pre><code>import pycurl
  c = pycurl.Curl()
  
  c.setopt(c.URL, 'http://someurl')
  c.setopt(c.FORM_FILE, 'myfile.gz')
  c.perform()
  
  c.close()
  </code></pre>
  
  <p>Would become:</p>
  
  <pre><code>import pycurl
  c = pycurl.Curl()
  
  fobj = open('myfile.gz', 'rb')
  c.setopt(c.URL, 'http://someurl')
  c.setopt(c.FORM_STREAM, fobj)
  c.perform()
  fobj.close()
  c.close()
  </code></pre>
  
  <p>Thanks in advance!</p>