Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Streaming multipart/form-data parser

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


$ 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. Additionally, this package includes a C extension, so please make sure you have a working C compiler available. On Debian-based distros this means installing the build-essentials package.

  1. Git clone the repository - git clone
  2. Install the packages required for development - pip install -r requirements-dev.txt
  3. That's basically it. You should now be able to run the test suite - make test.

Please note that tests/ stress tests the parser with large inputs, which can take a while. As an alternative, pass the filename as an argument to py.test to run tests selectively.

You can’t perform that action at this time.