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())
>>>
>>> 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. Additionally,
this package includes a C extension, so please make sure you have a working C
compiler available. On Debian-based distros this 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.8.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc630d08932eb984f6d6affc494ed257e0656625aec1d7b1a4e948eb58ca86ee |
|
MD5 | 887b193e6c6524b6fca72863e7f7898c |
|
BLAKE2b-256 | a365671dcf2054d1514dcfa8b942b79bfd6c3680a9fc88e106a79c565a239c1a |
Hashes for streaming_form_data-1.8.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4dbd40dddf15d4013a632521418e96f6e59970cbbe26da1fa0ab2c78f2deb03 |
|
MD5 | d7e0523b16eae1601d1f5265e900dc13 |
|
BLAKE2b-256 | 086b3df5f440c520f1a1d44185624aeb8c8889192b1887d81a03189bbc693419 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc0287c5c8fb894f35441e2c58292e2aaa7906b2afcc5f980fa2c37b7c02545a |
|
MD5 | ef5d553251c66ba74924e3c0fe1a5ce3 |
|
BLAKE2b-256 | 1bdf88479be8e1dae921544755b0cfb65e22844c33d455a754a8fd973ef5a622 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2e7079319942cdc38674a18fce86877254a94ec1985e05503aa2dce8a619c84 |
|
MD5 | b7666601e3ac9026dcd67978d699a60f |
|
BLAKE2b-256 | 0ac068a1496d5aa35a821380fd05d717cb8dc8c073c5c6bdccbfafacfc866dd6 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91d043b4d5e16cbf9442288d29dbaa1e3d332214f81d5ac2a7d41414df0f6a60 |
|
MD5 | f668f59a924d21e470c032420248aa4b |
|
BLAKE2b-256 | 20382de4e3f4e13e8a35ab2e10a95b7bd7eb2664646b47d47c70dad41b3561e7 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7426649146905ee3d232d0795db0a222b8aa559fc640b783feeb08db2d791ab9 |
|
MD5 | ade0ff1f88525c67eb2d778e95832dcb |
|
BLAKE2b-256 | 9a0f4199419ad1ae3b4db70ba94243fe8fdd7bfb44783134dc65b51af13a1f05 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b9f52d450fd6509564cbd471a50cee1eb876cae3e3120ec49dd9f6be20a1e84 |
|
MD5 | 7ef94d21bdeba45476130d8dd310535e |
|
BLAKE2b-256 | 32dd7e087dcfbe24c3ac5df045423754977290ca3f824a09eb017ae5482363a7 |
Hashes for streaming_form_data-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b667b4d6fe3f1b17468774852f2346da2ac47a07ab62726c02940af19224bb4 |
|
MD5 | 345c179abeed1c2217597fcc12f17f0a |
|
BLAKE2b-256 | 3b165d469c6b929852f27fd3886c5605d9d29f2733b3538912792b1f95ce82dd |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 287fe0b09add4087f60c80717aad3958903091f088a5cb67320cbeb206ee05cc |
|
MD5 | 692e192e27251bdd66b6f76fcc69a1e3 |
|
BLAKE2b-256 | 2b88fc6363c6328c05181a47461a92af9fcb67b73c807d685aa9f40c2b9cf330 |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3bf5c3d7be97dd8270e2e201dc9ca7f86cffcfe702e520b9a196eba7a043c3e |
|
MD5 | 96e0d1cc1f4fabc2c407a215ce2b7d3e |
|
BLAKE2b-256 | 5f92facfe343a789218435824568c8484d6daa9348b7c9fc4dd74fb226d795a5 |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb6f6347d216060089696a2bf29a5026213c2c982763f0aa31830e81025b7cd |
|
MD5 | 71ca29ca36bab8d007b0b17ce2b98fa3 |
|
BLAKE2b-256 | ff80e4f8f4fb9f56ac4526529ae5e322885510f759f0078ce670cb0e59530996 |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 706911e00fbfebc2216cfb4ed9ac7f40f84f5ed295494ee52ac3ca89bdb0d3de |
|
MD5 | d4206499640d5fd0547ecf23c2f52693 |
|
BLAKE2b-256 | 585f0c17d88f13135962de12e9bc63c4be9b004f18afb318c0fd8f97217e7d68 |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b495ee2597a4f9644d3fcfd6cfe07dd54b1ebeb80981b15c327d92548a4eeaf |
|
MD5 | 2263b82d641d785bb7ce5fc0ab608dd3 |
|
BLAKE2b-256 | f384c4e1d589140344d35be781079e54cf607fc9a1ba661019a13cbe3ae5af33 |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b28ed642e3c4e36005fd3328a8c95cf638c5c2eda91c8ec36e136278eefb8e64 |
|
MD5 | fc7bda68fa146f3ba88701371cda8d27 |
|
BLAKE2b-256 | 5317a10e7e4bf05968b0f14d36b15ac4149838d660796f7d865486106daf344e |
Hashes for streaming_form_data-1.8.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1ee5b640877a8dd1cfe07c94e6d0f14e21cc749c1bb69901ef3c2929ff9153 |
|
MD5 | 24f49a6498358a28bcc5c05f2ba1cabf |
|
BLAKE2b-256 | e696dbddff4dabdf3e45ff5525597d4c2b9517092623f63ccfc462dcf44b4e77 |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f62945ae3f7c6f933ac9be9197e5d569c173336119fb0bb7c2e0f965fdd45ef |
|
MD5 | aa98536ecb1151f39ce38c9473d05eaa |
|
BLAKE2b-256 | e8cafb9555ddd9291f861e1ecde69a98e28d83e3e2efd2304fdf120e9168dc06 |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e2cd7019180f146c6948660e22968eea6384aebd3b219678727e1d17aa2f434 |
|
MD5 | 36d5996203c384856f3cdefe3edcff70 |
|
BLAKE2b-256 | cce59f7ddde16622afe425e3c072da9012c0ed3b58fb9e430bb277ba803019ac |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c36b206f177ab70ba2054e9a4b27a6ce1d15117f7ea3394636a093d9dac65159 |
|
MD5 | 791dbc54017572e8582bcdf155db3ac0 |
|
BLAKE2b-256 | f75657cf58e7e5514e2759f6374f07e2984cb943c1c8f20c9603cc4186a78f02 |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe74c07a0be44e1106e21d804d8ca4309fa73bf579dc10617057556776b0440 |
|
MD5 | 3183cead3ab63d7bca5cdf7382580331 |
|
BLAKE2b-256 | 5bc3753ce291c47c4f6446f6939486792afdf45d51b1aa5e1f3078a1bf873abf |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce37986e2f12bc7f47b642d4493b88300292f3ad50f0748e0b2a974684d23e41 |
|
MD5 | f0adba1b29526452d9ac2a0f90bb75f4 |
|
BLAKE2b-256 | f40eefc6611af684fb9a603789e026cde5953f12b62fb3d000d52b1674d50bee |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b2dd90afa8718343f0c0b780362e385bf7fd6b176e435ff8b7f0c7766636fcf |
|
MD5 | 85f21fa4029cd23841d8bc9236cbd95c |
|
BLAKE2b-256 | 186ae7a140c01fc869385d79d9059e0264a3d5c991bb8ad4c1025be6038d628f |
Hashes for streaming_form_data-1.8.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f98c0315cf24fa019cd3f8353a8042fa94ed667e5124283be87449237c8deed |
|
MD5 | dc1f9569592bd684a73d394bc5e2f6a9 |
|
BLAKE2b-256 | 549834722bf555f9a38d8e2f85c288bc735966ae8a27fa20c164aa09f93d932a |