Description
streaming_form_data provides a Python parser for parsing multipart/form-data input chunks (the most commonly used encoding when submitting values through HTML forms). Chunk size is determined by the API user, but currently there are no restrictions on what the size should be, since the parser works byte-by-byte. This also means that passing the entire input as a single chunk should also work.
Please note, that this library has only been tested with Python 3 (specifically, versions 3.3, 3.4, 3.5, and 3.6). Python 2.7 is not supported yet, but pull requests are always welcome. ๐
Streaming multipart/form-data parser alternatives and similar packages
Based on the "Forms" category.
Alternatively, view Streaming multipart/form-data parser alternatives based on common mentions on social networks and blogs.
-
django-crispy-forms
The best way to have DRY Django forms. The app provides a tag and filter that lets you quickly render forms in a div format while providing an enormous amount of capability to configure and control the rendered HTML. -
Nigerian States
Django Nigerian States is a comprehensive third-party Django application that provides a robust and efficient way to manage and interact with geopolitical data related to Nigeria.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Streaming multipart/form-data parser or a related project?
README
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).
Testimonials
"this speeds up file uploads to my Flask app by more than factor 10"
Installation
$ 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.
Usage
>>> 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)
...
>>>
Documentation
Up-to-date documentation is available on Read the Docs.
Development
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.
Git clone the repository:
git clone https://github.com/siddhantgoel/streaming-form-data
Install the packages required for development:
make pip-sync
That's basically it. You should now be able to run the test suite:
make test
.
Please note that tests/test_parser_stress.py
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.