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.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e51de497cac50738149c0f73e129edcfd38204ebc272ce1bae1c0d9c9b851b67 |
|
MD5 | 5d53fd3bf0ed598f87f80e373a680a81 |
|
BLAKE2b-256 | 1d66df5479381a3289d08737611f5e5823d27ad3fa33433997806b31397fdf3a |
Hashes for streaming_form_data-1.10.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e3ee0b800cb7d7b3ab75416f113ecdb461b3e670d95bdf9b5be82afd3b61ccb |
|
MD5 | df96b292b068e057af6b76db4eeeefb0 |
|
BLAKE2b-256 | 5050e059c8ad8644b95a59679d03330bfc172fb55ed546885b200f4da11b8688 |
Hashes for streaming_form_data-1.10.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae30500fef6f05eb5e5e9ced994ea6c9818b26b2b1e5ca8c5fd8dc7ae1c3e41d |
|
MD5 | 6c0372a81423f5c2da7217fe3e85ff84 |
|
BLAKE2b-256 | 6ccc31c4cd13fbdf5b375cbfa485a54374efd0fd398deb471f9a34d15aa19498 |
Hashes for streaming_form_data-1.10.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c15e39b8839882b36648455d71cfe2f92cca6208d5275c4c089c41124af969e |
|
MD5 | a368a2abf1949fef39f711b4bc671e4b |
|
BLAKE2b-256 | 94b787cf262d61ee6bc9952ce49722b8e51093b71e776a1ed756afa64b7bf72f |
Hashes for streaming_form_data-1.10.0-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b447490f7191171ddd6a2352e2500e307dfe66750f7a48eaa671af02f8a3b487 |
|
MD5 | 6f0799b5e408ffc22a3317ce8db2e4af |
|
BLAKE2b-256 | 666bb7a71c90ccbe9b291c93426d7d09acaa2ba5a5f707395b43bd48b96ca9a5 |
Hashes for streaming_form_data-1.10.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a36628a7116d71fb46cbe6b7ee78ee2d7c7d1bc98c1c4e8e020118261a428e |
|
MD5 | 9cefd46f2c2b30c37643df6182e08439 |
|
BLAKE2b-256 | 0872194a2e8e636b6f7a1ee46083c43ea80a1ecad0d7aa42f78b9db1fa0ecf3f |
Hashes for streaming_form_data-1.10.0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 546b3582f3d6e7bda5e8d3dd9936b1fdf3ae7a88857c9647e4ed071f644eb760 |
|
MD5 | 00c3c924cef6641a77170090ec4d332c |
|
BLAKE2b-256 | a15f453e077e3bdac904cf7ff7ee1a0a217b001fb0db0ea1a3c9b094819ded47 |
Hashes for streaming_form_data-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ddaf17723e0761fafd302b316ca848b7681b80a1ac2bd93e03a2f6b6b723504 |
|
MD5 | 250f192150c1aa1c76d18e3551a939b1 |
|
BLAKE2b-256 | 094ff461fb982b80480c77775f0648071458f7623d9fb8d4d7fac1b62cefc7bd |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfec0b95c8ec5d9339c4e93883c470686084c984e682d7b1b4534f9f16fd233c |
|
MD5 | e04a49cb02b8677d37f5ccdf1c53f3b0 |
|
BLAKE2b-256 | a922079da3b07a8d546fbbbccbd0d3e65e30eb46be3456fe8a2c3f39cc061064 |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddfb45fc6f64183af5b98e25c9be8a4405104d5d6101dfec50006647fa168148 |
|
MD5 | fdb876d509632d2a613ebb3be8109280 |
|
BLAKE2b-256 | 57b52226caa839c5d730f29f8d056c903e4f77443c98d362995a9268a9f1af63 |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7267728a231601b4a869fb572019f27bb9baaa10f44dbbc44cdc88f230862565 |
|
MD5 | 7602e04496e28ba11b2cde661e96269d |
|
BLAKE2b-256 | 2540ef825bf02271c4909730ecde8fe542bab989eb61f62c73aeca0004aacda8 |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a2010984f62bffdd47ec35b93919fa5a1ced23668da6f8f45e4728af941fafb |
|
MD5 | 86b00772d23d01c0fda66e5e5b835c28 |
|
BLAKE2b-256 | 6290c8b18bd35b64ff1d187bdb54ae3cb2b582071a845c629196e0cb1b142b9b |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb47967a5d6eecb9a81306f93ff4685c00890a39ebd7bcf87bf4cc7860ee006b |
|
MD5 | 344b93efe4930b4292ab3d0aa82f4af2 |
|
BLAKE2b-256 | 0e7886589d84619910bc236d0adf89c8227701d18c5ffac244be11ba61eaf91c |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2edaadf136f585f19fca82ed33d7b2e47e5e95aee838ef30a954e69f1b8b622c |
|
MD5 | 05221d7446e03bb94c695f3561449bae |
|
BLAKE2b-256 | b4165c528a80c5505e6229505c9252b11c8be227a0bfc468d59ab93ab1fb969d |
Hashes for streaming_form_data-1.10.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7579d58fcf119d46ef83745c05b455ddd0d485edfa0713a6ca03eb6da065cfd5 |
|
MD5 | 5b04bdc487eda3517cdc186adc75ccd8 |
|
BLAKE2b-256 | 1d206c7a94bce2e2e5582742dbcc10a7bc13594f530241ed021c7ecdd7421570 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ed32c2ebac9892e506e1285893fe6d7ce6de0403a83f021c4b4adf61c1b5f1d |
|
MD5 | 9429245ef0a4d2ed2add8cf15e3eb48b |
|
BLAKE2b-256 | 43535964a0650aa6ec06f1f41dfc603baaab09e29d8c3d5274ee9c889cbb7a3b |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae349063bfe89e64467ffcd53421ccb0da180da15592d2cdba66311901c89116 |
|
MD5 | 1d3d4b659a2c27626690bb62e03ff583 |
|
BLAKE2b-256 | 61654006f9ef96c23900ee6b506a00eb7c36dc81886d6f44de3883f405032188 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9658df8811e8fd8084da3e9f0197e7a34539cbadb23f82b2f1c3c0efc567c923 |
|
MD5 | 52b76c6a84962315ff9a21f1515eb8c9 |
|
BLAKE2b-256 | b12248f869a38f646f0c72bf7b08c77be924db712ff0abb2785365f9524701a6 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c616afe95487e6338f8beccfcfa76f3925d519e29dbcd8d5a4dcc0da196616ae |
|
MD5 | 0f750ff8f99520b89c61df9e1609c92b |
|
BLAKE2b-256 | ca21f7c01b6a8cf0a966b3c8f1a2ca6d4a222ba10e8c638ec45abc11f19f3953 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13b9843f5649ce01000277275309dc612dbe1d829faff65708578379b4bccaae |
|
MD5 | 066067e0072469785c19597cbef544c5 |
|
BLAKE2b-256 | a0d54a9273991c2ecff2b3c950e2abab28a998f37914f3c8d3422b534e3d0820 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3e5efe50375edd2b08eefb877002f0cf272f343cdc3b5fcc80ca5a1347a08d |
|
MD5 | 2eafe07e1874619bf2c454af8da8a2a5 |
|
BLAKE2b-256 | 1fe01a5d85831db4e7ff5bc5011886a498fd5d7aa3b3e88cf3841c207fdf85a2 |
Hashes for streaming_form_data-1.10.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2de630142334e496ebd8eb684bd1fcef352492dd9097ecb30e9b41d555258260 |
|
MD5 | 3fdbd633d65b83ae3d3d15d88552b4ca |
|
BLAKE2b-256 | 960af2519b1b156e989eec8f305124779ded261c0e3a5bf976cb325c10db1f9e |