Skip to main content

Streaming parser for multipart/form-data

Project description

Streaming multipart/form-data parser





streaming_form_data provides a Python parser for parsing multipart/form-data input chunks (the encoding used when submitting data over HTTP through HTML forms).


"this speeds up file uploads to my Flask app by more than factor 10"

"Thanks a lot for your fix with streaming-form-data. I can finally upload gigabyte sized files at good speed and without memory filling up!"


$ pip install streaming-form-data

In case you prefer cloning the Github repository and installing manually, please note that master is the development branch, so stable is what you should be working with.


>>> from streaming_form_data import StreamingFormDataParser
>>> from streaming_form_data.targets import ValueTarget, FileTarget, NullTarget
>>> headers = {'Content-Type': 'multipart/form-data; boundary=boundary'}
>>> parser = StreamingFormDataParser(headers=headers)
>>> parser.register('name', ValueTarget())
>>> parser.register('file', FileTarget('/tmp/file.txt'))
>>> parser.register('discard-me', NullTarget())
>>> for chunk in request.body:
...     parser.data_received(chunk)


Up-to-date documentation is available on Read the Docs.


Please make sure you have Python 3.6+ and pip-tools installed.

Since this package includes a C extension, please make sure you have a working C compiler available. On Debian-based distros this usually means installing the build-essentials package.

  1. Git clone the repository: git clone

  2. Install the packages required for development: make pip-sync

  3. That's basically it. You should now be able to run the test suite: make test.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streaming-form-data-1.11.0.tar.gz (93.4 kB view hashes)

Uploaded source

Built Distributions

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page