Popular recipes tagged "meta:requires=mimetypes" but not "generate"http://code.activestate.com/recipes/tags/meta:requires=mimetypes-generate/2013-09-22T21:27:24-07:00ActiveState Code RecipesEncode multipart form data for uploading files via POST (Python)
2013-09-22T21:27:24-07:00Ben Hoythttp://code.activestate.com/recipes/users/4170919/http://code.activestate.com/recipes/578668-encode-multipart-form-data-for-uploading-files-via/
<p style="color: grey">
Python
recipe 578668
by <a href="/recipes/users/4170919/">Ben Hoyt</a>
(<a href="/recipes/tags/form/">form</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/multipart/">multipart</a>, <a href="/recipes/tags/upload/">upload</a>).
</p>
<p>This function lets you encode form fields <em>and</em> files in multipart/form-data format for uploading files via HTTP POST.</p>
Sending Email in Python (Python)
2013-02-24T13:47:01-08:00James Millshttp://code.activestate.com/recipes/users/4167757/http://code.activestate.com/recipes/578472-sending-email-in-python/
<p style="color: grey">
Python
recipe 578472
by <a href="/recipes/users/4167757/">James Mills</a>
(<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/email_sending/">email_sending</a>, <a href="/recipes/tags/sendmail/">sendmail</a>, <a href="/recipes/tags/smtp/">smtp</a>).
</p>
<p>Every Python Application needs to send email at some point. Whether it's for reporting errors, status updates or simply the core functionality of the system this little recipe should help! Documented and Tested.</p>
Send HTML or Text email with or without attachments (Python)
2009-07-27T13:14:24-07:00Isaac Wagnerhttp://code.activestate.com/recipes/users/4171255/http://code.activestate.com/recipes/576858-send-html-or-text-email-with-or-without-attachment/
<p style="color: grey">
Python
recipe 576858
by <a href="/recipes/users/4171255/">Isaac Wagner</a>
(<a href="/recipes/tags/email/">email</a>, <a href="/recipes/tags/smtp/">smtp</a>).
</p>
<p>Using code gleaned from the net and from my own brain I created this convenient wrapper to send email messages via SMTP in Python. This class allows you to send plain text email messages or HTML encoded messages. You can also add attachments to the messages.</p>
Python 3 WSGI Server (Python)
2009-09-22T11:36:30-07:00poops mcgeehttp://code.activestate.com/recipes/users/4171745/http://code.activestate.com/recipes/576906-python-3-wsgi-server/
<p style="color: grey">
Python
recipe 576906
by <a href="/recipes/users/4171745/">poops mcgee</a>
.
Revision 2.
</p>
<p>This is a simplified version of tornado's WSGI server implemented in python 3.</p>
<p>Example usage:</p>
<pre class="prettyprint"><code>import web
import wsgiref.simple_server
class MainHandler(web.RequestHandler):
def get(self):
self.write("Hello, world")
if __name__ == "__main__":
application = web.WSGIApplication([
(r"/", MainHandler),
])
server = wsgiref.simple_server.make_server('', 8888, application)
server.serve_forever()
</code></pre>
Web browser emulator (Python)
2008-05-15T01:09:08-07:00Laszlo Nagyhttp://code.activestate.com/recipes/users/4150221/http://code.activestate.com/recipes/572202-web-browser-emulator/
<p style="color: grey">
Python
recipe 572202
by <a href="/recipes/users/4150221/">Laszlo Nagy</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>Objects of the MozillaEmulator class can emulate a browser that is capable of:</p>
<ul>
<li>cookie management</li>
<li>caching</li>
<li>configurable user agent string</li>
<li>GET and POST</li>
<li>multipart POST (send files)</li>
<li>receive content into file</li>
<li>progress indicator</li>
</ul>
An asynchronous HTTP server with CGI support (Python)
2007-04-05T05:46:26-07:00Pierre Quentelhttp://code.activestate.com/recipes/users/1552957/http://code.activestate.com/recipes/511454-an-asynchronous-http-server-with-cgi-support/
<p style="color: grey">
Python
recipe 511454
by <a href="/recipes/users/1552957/">Pierre Quentel</a>
(<a href="/recipes/tags/cgi/">cgi</a>).
</p>
<p>This recipes implements the HTTP protocol with persistent connection and CGI support on top of the generic asynchronous server provided in <a href="http://code.activestate.com/recipes/511453/">recipe 511453</a></p>
Extract (Kill) mail attachments (Python)
2003-11-27T04:42:54-08:00Pasqualino Ferrentinohttp://code.activestate.com/recipes/users/1500701/http://code.activestate.com/recipes/252173-extract-kill-mail-attachments/
<p style="color: grey">
Python
recipe 252173
by <a href="/recipes/users/1500701/">Pasqualino Ferrentino</a>
(<a href="/recipes/tags/network/">network</a>).
</p>
<p>This receipe is a very handy utility to extract the attachments from your mail. Suppose you receive a good mail which has attachments. You want to store the mail but without the attachment.</p>
Http client to POST using multipart/form-data (Python)
2002-08-23T07:56:39-07:00Wade Leftwichhttp://code.activestate.com/recipes/users/98656/http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/
<p style="color: grey">
Python
recipe 146306
by <a href="/recipes/users/98656/">Wade Leftwich</a>
(<a href="/recipes/tags/web/">web</a>).
</p>
<p>A scripted web client that will post data to a site as if from a form using ENCTYPE="multipart/form-data". This is typically used to upload files, but also gets around a server's (e.g. ASP's) limitation on the amount of data that can be accepted via a standard POST (application/x-www-form-urlencoded).</p>
Use email module to bundle contents of current directory (Python)
2004-08-24T01:45:29-07:00Matthew Cowleshttp://code.activestate.com/recipes/users/139430/http://code.activestate.com/recipes/86674-use-email-module-to-bundle-contents-of-current-dir/
<p style="color: grey">
Python
recipe 86674
by <a href="/recipes/users/139430/">Matthew Cowles</a>
(<a href="/recipes/tags/network/">network</a>).
Revision 4.
</p>
<p>An example of using the email module to create a multipart MIME message.</p>