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).
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 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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 532c7f70697fcc8a9a37b56495dcf36df11feefe42f626cff789beac11728f45 |
|
MD5 | cbe0df2674059fe93302dc02d5f6f85d |
|
BLAKE2b-256 | f20393279c79b5589c932529d089ba1e20f7d08985e1697276224383acc91567 |
Hashes for streaming_form_data-1.10.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1fef64b966f6ff13f279131705696f4a04b29514afe288c24fb50802fe394b6 |
|
MD5 | 4bba83d9c5d12f570d795f6e069c5c3b |
|
BLAKE2b-256 | a72af608587413dbbdad193afdd57eaeb098873a9b2b1f9a171d0ac1af0fb9be |
Hashes for streaming_form_data-1.10.2-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b31fb147fe981cee0215e1f811f99d94dfcc1bdd1a717b4d5e4896b06db454fa |
|
MD5 | 1e8f49637df1a823490511599c60d19a |
|
BLAKE2b-256 | ec9c5a172d66c64952c96b3315fea8a8f6b3cfc1966dc141e852c131565a1622 |
Hashes for streaming_form_data-1.10.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e39645a1fcb09d7ed43960482f0d0d9747ec57c47115238347c249ec663d28fc |
|
MD5 | 56ee5d40c9dba8ebce3eef827739895c |
|
BLAKE2b-256 | e423eeee7991641f601a0905831e352a5211685e1c7cfa6731d60c1d65b9c613 |
Hashes for streaming_form_data-1.10.2-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ce1b8ce3bbe393d244e3ef6bde79c52cbf7a23f54e65c11a88d4bce9714db5f |
|
MD5 | 74c0f7c74574e37e5fdf133e275a8f2b |
|
BLAKE2b-256 | 57913f814a337632f01257333016c093f421c91dbb9c859df1e87825dbeebcef |
Hashes for streaming_form_data-1.10.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 989a8e2961c67707e04ce2d4f41daad9df8d52eebbfdeb6b3ed8ea1e431cb536 |
|
MD5 | 8048567576e50b9050d41c2772f38522 |
|
BLAKE2b-256 | 01010491685cf0293fcc0229658fc41ae05e6aa74834a913829dea212e07a696 |
Hashes for streaming_form_data-1.10.2-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bfbe6fa880fa35d73db187d5d52fda9b79c8f57944a078696714a24c3f9c3f9 |
|
MD5 | 34488511691a6cfbbc377c2040913c17 |
|
BLAKE2b-256 | 38e5dabda2a8c93d0e18787b3894d63e86e588a64ffa89c8082b2447bc99689e |
Hashes for streaming_form_data-1.10.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6f3adf6b334c90d0f4e3dfeddf5790f3299af7d4bed37824bfd471b17869a0c |
|
MD5 | ebd91c651ed156e5b4aacccd6bc05eae |
|
BLAKE2b-256 | eb7e37807104e17ef55a335dfebf7d6230ce1888e503a904fcf55dce59833e64 |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51cd8db8c6f65b0f17a05e021269a797d266aeb455e49cac2b125598fbac1518 |
|
MD5 | 6a68bca16f23e2813999ad3e1ad77a1a |
|
BLAKE2b-256 | c92b5abecc2f9e670444a46b0bda2c141a1db999bf60a234bfaeb0131c6e4837 |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20f619b674b5d5b1e1629b4dc60400f7dd4ed17eeebc27725664e45fe1cb68c1 |
|
MD5 | a4e3f93ec06847a298d5754b0a1ad1ef |
|
BLAKE2b-256 | 9eb1ef64e47bdfe45ad64cc7c063670a46800cdeb9e16fdae7e0adf7499f272c |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4b90e1020e94df2e7071899da3d8ab759e93252147f4353b929a7b731aec3135 |
|
MD5 | 18368bb22b084f243c51dae110139950 |
|
BLAKE2b-256 | 38e3a89de13e1bc181b8b3d831ba66745358663025e4e36d56cc415b99c5a09f |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c0a8a1a13e05de9c236aca6c3a3a0df13968fc7f1bda1869a8e4858ce0d4fdf |
|
MD5 | 652a02e977aff35bed9c26b6ed89e1a8 |
|
BLAKE2b-256 | 8e41ad6fbf02aecfaefd45f1e3d5deaeea28a42caa6996ab813353cab017bbda |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95cfa5306346a4ff0be74fb25e596ce2d068d928c5a3d35da03c08551174c932 |
|
MD5 | b26477ce226bdd7523b45fbeeca890f9 |
|
BLAKE2b-256 | 46adff76023e1469a61ec4e321a1b5146a57850c81dba307bd795dc6775b364d |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b236fcae398ade3af975da6fc519488e74fdef7d7c1c8d0b2015378de6ccd885 |
|
MD5 | b364158f6633c0d172853a125e0bac7a |
|
BLAKE2b-256 | 1f1707eb247b5bf95af3f55a6a65daa0c368afa121537a8540f41ca136f2ea07 |
Hashes for streaming_form_data-1.10.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6b334c9c664a39d546955a125502023ae26de8e40606a456a8c59e3cdb6f5a3 |
|
MD5 | 7d62644c037eab4ec372c118fb5f3aea |
|
BLAKE2b-256 | 649caeecfc5064e8efb53e2e094a9f71d54cd1bdb0e30aac124d8853d9161d4c |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c4932a6ce2c0b518bac5e024ff1452f4ed9046ca80e79bfdfd9dff883949a60 |
|
MD5 | 0c17a16dbe754592d44b018d9def265e |
|
BLAKE2b-256 | 9dbbbcf1d4cf2be0ec5c17d2a96efc630c885ac5b90f73a14d7e745b0d1e9b01 |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86aa5dabbd7d15a3dc8300d7c148b82715b6ced8b852e83ef52edab00c31777f |
|
MD5 | afcc322a2cb76914b2ef110ce7bef8f0 |
|
BLAKE2b-256 | 9f77f64411d1f6a8b06abd41abfead4c29e687889dc20520809346e2235d1cda |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f030f857b27392a7400b9eafe054614295057fbc4c2e5972b563e43dd1e0b8de |
|
MD5 | ceee9ad6978f6c1759bfd5ebc31de1ba |
|
BLAKE2b-256 | 8c93cf3c22d4b732ba547deb93d89ab71df40c2c909888cb9ef3e402a8466bfb |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cec3a0a7662fb3b54236340e17d59fd70508a39b5f0d6bc000fe57fe1a3a6945 |
|
MD5 | 8a9d9d61a9d2b9a0ebf715b5214cb274 |
|
BLAKE2b-256 | 4c9f09073b33a76a44d256c7f45ae088682ffc9bbfcf785a5f15df4c20964a24 |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8096fa9f229f4d32addff7a316f842f3f41ef05420a0661537802cd478613ec9 |
|
MD5 | 2794fd4e71ef84cda5ba36147a0fcf5c |
|
BLAKE2b-256 | a47fd1d409e04539d844eea0f9f088a4feac0e7645be33ebe75db0bd2bd2a7b3 |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebb2c1d31b21f0fffade29785c27bbacb8882605b9c0e51a317529ae5ad305a7 |
|
MD5 | d134e0c1669aababad38e149f867053c |
|
BLAKE2b-256 | b1f1619fe727f0c53df4e02197b609a825f48f0bf085f352a7fe63382ae5dbb3 |
Hashes for streaming_form_data-1.10.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d82534633c24f00e0fb3c46b90de1c21b1e97cb1403c7d002665b99ddecb5bb |
|
MD5 | ff1d2ac69986fd4221a67eb64468ffb1 |
|
BLAKE2b-256 | 947949696e9d050a2c318e68562772c5850378008326254739430f8428cf12be |