Streaming parser for multipart/form-data
Project description
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).
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())
>>>
>>> parser.data_received(chunk)
Documentation
Up-to-date documentation is available on readthedocs.
Development
Please make sure you have Python 3 and pipenv installed.
Git clone the repository -
git clone https://github.com/siddhantgoel/streaming-form-data
Install the packages required for development -
pipenv install --dev
That’s basically it. You should now be able to run the test suite -
py.test
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for streaming_form_data-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f955ddfa862407350534cd8250c18207493f320b654f7bdf3458c739ac7537f |
|
MD5 | 5a82368e32b648254d35dc2bb645db8d |
|
BLAKE2b-256 | 778156e7e58c2dbbedb37e172d12cedb18879149794a76cd6a845ccd9d149d35 |