Latest recipes tagged "post" 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ásztor <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 Smith <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="" rel="nofollow"></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 bussiere <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="" rel="nofollow"></a></p> Python HTTP POST binary file upload with pycurl (Python) 2008-08-14T04:47:36-07:00Robert Lujo <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="" rel="nofollow"></a>. But that didn't worked for me for binary data. I didn't liked/tried solution explained at <a href="" rel="nofollow"></a>, so I tried with pycurl (<a href="" rel="nofollow"></a> wrapper for <a href="" rel="nofollow"></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>