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).
Installation
$ pip install streaming-form-data
In case you prefer cloning the Github repository and installing manually, please
note that develop
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 -
pip install -r requirements-dev.txt
-
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.
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
Built Distributions
Hashes for streaming-form-data-1.10.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c543c284f7d054ba9ceb79a2570695e59ee343a272777b30ea4f0e99f6f650 |
|
MD5 | 684d5549c0c0470762baeee61566fe3f |
|
BLAKE2b-256 | c7d68c04546b634cd08650e29fef1d3a80fef79f419b01758b8415d6be0d14de |
Hashes for streaming_form_data-1.10.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4d6846057c069ce5912a65949ce01bb3e3eafec7f30c807c4a1e23e181973a |
|
MD5 | a5db092e3309119abd0c2febfa8dabc6 |
|
BLAKE2b-256 | cf40111f761cffd7112d0190f22c101d14a439a7b0fe2793e183a6fe8fc2ed55 |
Hashes for streaming_form_data-1.10.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d5455ec6faa6ee23241882c4cbf0e31527d8a7280a8485b242c1955be0f464 |
|
MD5 | a4391300ed226595fd69ed9d98d99e99 |
|
BLAKE2b-256 | a5f373d30d75791960e6cde45c9d74d909a595441eef8dbbb5b0493eabf5ae1f |
Hashes for streaming_form_data-1.10.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff321548a0804086bf28132fdb18ea80702f3ff603229148248c8fe863197438 |
|
MD5 | 3fac1b81169a7cb92bae286614b86178 |
|
BLAKE2b-256 | fc5749cc4ea4eefdb1959d3171dc7928336c19732d17266a1c93a9d8dd435333 |
Hashes for streaming_form_data-1.10.1-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f510829631d36c00b29a058b008acd99f165e24413a75d8546c4ebdea30c48 |
|
MD5 | 61f7f94d5f51cc8d3a442642c9a281f8 |
|
BLAKE2b-256 | 10fffa9c055dbcb8c4d44ff9ecce79685b4d2be550ed5e4ce65860ccd41d3b9d |
Hashes for streaming_form_data-1.10.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d7584ffcfe552887f94c0a3e199105b462d4cc1355bfde7de97cf7b1f3bb581 |
|
MD5 | 5c85751d2c670de126efdaf41121c2a2 |
|
BLAKE2b-256 | f3523dc2d7339cdbb52376204f9e1d962a64dad2301e31013542b85e7aa3c2e8 |
Hashes for streaming_form_data-1.10.1-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3a94acf7f2341475e7a5b973b46e029bdefdb3c7c13ff54a5ad45dc997b8f9b |
|
MD5 | 49fb4444314b49eca2e0b96e5eff46e9 |
|
BLAKE2b-256 | bc9b9d30ef51b34c4e5b8c3b22bd3afabf7919dd80aaf02e2a4548a265c07572 |
Hashes for streaming_form_data-1.10.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d299ec6ee0c59da025a664d516481a9d60cd99d492b068444b0b97dbef85996a |
|
MD5 | caa548142c78d8c0366e62c4884f4597 |
|
BLAKE2b-256 | 9025115ac6610a3709a8f093fab748b8110ceb22391c221cbe6974725a9af8a6 |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 247ca31011dcec4605debd7ce298eacc0aa495c168e0528e6f8f90396d5e2bf8 |
|
MD5 | 8392892f8f5ab112fe33b5f4a66bbc21 |
|
BLAKE2b-256 | 610425a5c64228cccc86e3d6ba2f939d38b14290a1e76ede92bdd0f9dec195b9 |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 701a53da61f3c5e8f185f15e28b7cfc9fe02b66ae68b5638f6355cc19087cea5 |
|
MD5 | 4d90d52f269fdd3658fa5a52c118dbb2 |
|
BLAKE2b-256 | badaa0f24da168ac739a7a47e084bc8a63049a720790edead6bbcec2cdd44f18 |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74d51979fcbcee7e33144efcd379ab2ae1494884dab1a0ddbfc90b671a3cb9ab |
|
MD5 | 41dca7943826f20c17607176195b8e50 |
|
BLAKE2b-256 | 516eb90eaef117d6748ba8886450465a8a3f45e960a7fb058bac18e04e603130 |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69185c3d1a2cdda6a33a633135f40edb7efb39f193e28b2e8ff71f0d907010a8 |
|
MD5 | 4f8c515b402929606bc4e876e4489d5e |
|
BLAKE2b-256 | e2dff6fff4a3462b049f68460f9e1d0c48c1ab218ad8d5eb0d03008857ee42dc |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4d1a90d375909d53787990cbd3edf93f4db33d751c695aef6ef31a51fd3b215 |
|
MD5 | a92fce9808078c49dc7a695e5f9ce2c2 |
|
BLAKE2b-256 | b7409132b695b8b1106c817a702b74a6abefc0b242a37aac069b00b4d97a8c53 |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a418e361c9ecf64968b7f70d8029c82f63ad2925d6022804389c3937a9f6297b |
|
MD5 | afbe6c667e0d53f89a20d2faaf47c4a1 |
|
BLAKE2b-256 | b041482363d229d0f923ffd5c235cd33c8571058e38f7d3575647d74656b241b |
Hashes for streaming_form_data-1.10.1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 225f8aceb349dd6a8360e6f31ad2c4e3c7c6a18a0910a572bf66afe853fbe381 |
|
MD5 | 81c9852a7d625ffda4b2fd3cc4f0c737 |
|
BLAKE2b-256 | 03187ced8176cdba9db25ba759a1cc56dc24c157e7b004b972e88687ed0c16df |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc08c0e75e39405f4c98286be62b90da88a074e2a9eba9667629a4b784dd1682 |
|
MD5 | 956e18ea1aebc08dade01a7af197178b |
|
BLAKE2b-256 | b46a42ee5d80bff90222d5e91f91a909070033753cb4491aa939dac5c7c92fa5 |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c8b958c96081e8f83950b0c42b12afec8de118e07fa3dfebaf597c2d0ec5733 |
|
MD5 | 7418f405880d69f528fcaabca91abac3 |
|
BLAKE2b-256 | a3b11b33f49e07a5eb9c39767b18a61752502509c144b366e46bb9b61a46e4f2 |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3448c7dac9670e42d787e584e9681c099c55c3be9a73b93ab653cd74a1cf5695 |
|
MD5 | 5caae1a80835de1c47e9ad108ae694a8 |
|
BLAKE2b-256 | 2ab4505be4a81284fa32b043e8f72cebed9c6fb2837c4e8a9e3ca29f0969ce98 |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 961947e166051a82122c3320f2b87b71a770e8ed5aeabe0affd287c6d4e430f3 |
|
MD5 | ae39c9917a2a86af66fe3be6d3c47071 |
|
BLAKE2b-256 | 06341d3ac7480bb681e89af0f9ce5bd48eac53f66cc7992b393fe725f8785adb |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6dbe2bde72ef312cbd245f09dca0bc7dd99206e347c35b4f36f3a69f8157675c |
|
MD5 | 8951d7292e049e7a41b045a13e45885d |
|
BLAKE2b-256 | da7cd320416f0d8c5bdb191c54f6e6012a894b77598703ca771df62b95c027d5 |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aba0c0fce77a7e33b88648bcdacab4bf896a18b09589a592e1421d9ea7792a5 |
|
MD5 | fc9caa55a075fb84015d79d28ea34770 |
|
BLAKE2b-256 | cdb4046d1a1b3cca5cc7072c8f7415a8f28d50f65691f9404d7942a2bb19dfe2 |
Hashes for streaming_form_data-1.10.1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2080110c7b037f50797b54590c3c91a39b77db163f9f5dc80d59b2870fe9c99 |
|
MD5 | 5934f22e15206cc5a8c6272ad336c0db |
|
BLAKE2b-256 | f248413d0bc906f3b84c4bae5025c61deb5038cfd5571a08ff28938879f67ce4 |