Latest recipes tagged "post"http://code.activestate.com/recipes/tags/post/new/2014-03-08T17:34:38-08:00ActiveState Code RecipesComposing a POSTable HTTP request with multipart/form-data Content-Type to simulate a form/file upload. (Python) 2014-03-08T17:34:38-08:00István Pásztorhttp://code.activestate.com/recipes/users/4189380/http://code.activestate.com/recipes/578846-composing-a-postable-http-request-with-multipartfo/ <p style="color: grey"> Python recipe 578846 by <a href="/recipes/users/4189380/">István Pásztor</a> (<a href="/recipes/tags/field/">field</a>, <a href="/recipes/tags/file/">file</a>, <a href="/recipes/tags/form/">form</a>, <a href="/recipes/tags/html/">html</a>, <a href="/recipes/tags/httpclient/">httpclient</a>, <a href="/recipes/tags/mime/">mime</a>, <a href="/recipes/tags/multipart/">multipart</a>, <a href="/recipes/tags/post/">post</a>, <a href="/recipes/tags/upload/">upload</a>, <a href="/recipes/tags/web/">web</a>). Revision 5. </p> <p>This code is useful if you are using a http client and you want to simulate a request similar to that of a browser that submits a form containing several input fields (including file upload fields). I've used this with python 2.x.</p> Pastebin Upload (Python) 2013-05-26T10:54:25-07:00Joe Smithhttp://code.activestate.com/recipes/users/4168055/http://code.activestate.com/recipes/576805-pastebin-upload/ <p style="color: grey"> Python recipe 576805 by <a href="/recipes/users/4168055/">Joe Smith</a> (<a href="/recipes/tags/code/">code</a>, <a href="/recipes/tags/post/">post</a>, <a href="/recipes/tags/source/">source</a>, <a href="/recipes/tags/urllib2/">urllib2</a>). Revision 2. </p> <p>A little script I made for some buddies and I. We are constantly collaborating on code. This scrips takes a source code file as it's parameter and uploads it to <a href="http://pastebin.com" rel="nofollow">pastebin.com</a> or any sub domain of pastebin. I integrated it with the righ click window in windows. Without that integration the script wouldn't be as cool! Hope others find it useful.</p> Post automatically on the python cookbook (Python) 2008-08-20T10:50:07-07:00bussiere bussierehttp://code.activestate.com/recipes/users/4050557/http://code.activestate.com/recipes/576439-post-automatically-on-the-python-cookbook/ <p style="color: grey"> Python recipe 576439 by <a href="/recipes/users/4050557/">bussiere bussiere</a> (<a href="/recipes/tags/add/">add</a>, <a href="/recipes/tags/automatically/">automatically</a>, <a href="/recipes/tags/cookbook/">cookbook</a>, <a href="/recipes/tags/form/">form</a>, <a href="/recipes/tags/post/">post</a>, <a href="/recipes/tags/recipe/">recipe</a>, <a href="/recipes/tags/tag/">tag</a>, <a href="/recipes/tags/tags/">tags</a>). Revision 3. </p> <p>hok to make a post by a little script it need httplib2 : <a href="http://code.google.com/p/httplib2/" rel="nofollow">http://code.google.com/p/httplib2/</a></p> Python HTTP POST binary file upload with pycurl (Python) 2008-08-14T04:47:36-07:00Robert Lujohttp://code.activestate.com/recipes/users/4044016/http://code.activestate.com/recipes/576422-python-http-post-binary-file-upload-with-pycurl/ <p style="color: grey"> Python recipe 576422 by <a href="/recipes/users/4044016/">Robert Lujo</a> (<a href="/recipes/tags/django/">django</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/post/">post</a>, <a href="/recipes/tags/upload/">upload</a>). </p> <p>There is a way to upload file with standard python libraries (urllib, httplib, ...) as explained at <a href="http://code.activestate.com/recipes/146306/" rel="nofollow">http://code.activestate.com/recipes/146306/</a>. But that didn't worked for me for binary data. I didn't liked/tried solution explained at <a href="http://fabien.seisen.org/python/urllib2_multipart.html" rel="nofollow">http://fabien.seisen.org/python/urllib2_multipart.html</a>, so I tried with pycurl (<a href="http://pycurl.sourceforge.net/" rel="nofollow">http://pycurl.sourceforge.net/</a> wrapper for <a href="http://curl.haxx.se/libcurl/" rel="nofollow">http://curl.haxx.se/libcurl/</a>) because it is std. lib for php, and uploading the file is very simple (just add @&lt;path-to-file&gt; to post variable value). It was a little hard to find proper way because there is no such example or documentation. But I found it, and it is so simple ;)</p> <p>I supply django test application which receives file that is uploaded.</p>