Skip to content

Instantly share code, notes, and snippets.

@sarva
sarva / multipart_uploads_test.py
Created January 21, 2012 03:32
Streaming multiple files (multipart/form-data) PUT uploads to Tornado (uses a fork that supports body streaming)
"""
This example requires the body-streaming tornado fork at https://github.com/nephics/tornado.
Refer to http://groups.google.com/group/python-tornado/browse_thread/thread/791c67cb86c2dea2.
Supports uploading an unlimited number/size of files in a single
PUT multipart/form-data request. Each file is processed as the stream
finds the part in the form data.
==USAGE==
@didip
didip / request_handler_test.py
Created March 12, 2011 21:46
Testing Tornado RequestHandlers
import unittest, os, os.path, sys, urllib
import tornado.database
import tornado.options
from tornado.options import options
from tornado.testing import AsyncHTTPTestCase
# add application root to sys.path
APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(os.path.join(APP_ROOT, '..'))