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 main
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 FileTarget, NullTarget, S3Target, ValueTarget
>>>
>>> headers = {"Content-Type": "multipart/form-data; boundary=boundary"}
>>>
>>> parser = StreamingFormDataParser(headers=headers)
>>>
>>> parser.register("name", ValueTarget())
>>> parser.register("file-1", FileTarget("/path/to/file.txt"))
>>> parser.register("file-2", S3Target("s3://bucket/path/to/key"))
>>> 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.8+ 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:
make pip-sync
-
Install
streaming_form_data
itself:pip install .
-
That's basically it. You should now be able to run the test suite:
make test
Note that if you make any changes to Cython files (.pyx, .pxd, .pxi
), you'll need to re-compile (make compile
) and re-install streaming_form_data
before you can test your changes.
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.14.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 719e82a822de77acef8e46a70bce13823886ec37a3fdf977110c061605b5c945 |
|
MD5 | 73733f732b6ca484e96ea18ca6f41dbf |
|
BLAKE2b-256 | 6197d9edf6ec12cf1f886b70eda582c238fd64a86eeed282ab2602a18d0413b0 |
Hashes for streaming_form_data-1.14.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd8f62ebbb1fd2971e81a26027c481d35e7246805ba2fcd2d1ec6cfc1e1ef616 |
|
MD5 | f698d25685cd90c701a5f2ede8244a3b |
|
BLAKE2b-256 | a7cad1d415f940cbf0a0ad49717234153de2c77249c3035328281e73db4e49c7 |
Hashes for streaming_form_data-1.14.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0d189ca04aba6c192c574243d4f354d5db39b17c6c37185b4a490b2c1d8e574 |
|
MD5 | 30d60999f202702b57c7df43bb4f6c0d |
|
BLAKE2b-256 | 022ecbbdb670ac54e4154ed3e648090a5de72c46f817854f5a03547751f08f2f |
Hashes for streaming_form_data-1.14.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ae8f08623835ed7fe15267554b766e3a1b925c3f1b7701e0866435050218d1f |
|
MD5 | 8c640ee0507a075a7605efde5fb269a0 |
|
BLAKE2b-256 | e023fb8cfd133bc91702d04eb7bbc00635b537b5652a1247cb63634a7699df2c |
Hashes for streaming_form_data-1.14.0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c59715ac2342b8d4b97aabfd987838c8c3a69201fa469f3536ed71a3beef3c1 |
|
MD5 | 6ec7725626c1cddc398b85e4c1520d3e |
|
BLAKE2b-256 | f90137e754feaa29bec0aa5289b1a4ba94599dd342795351558a3439628843d5 |
Hashes for streaming_form_data-1.14.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11bff2bdb06204af8519c3ffc42ad8b3758b83c10214078d28f994e5f8ae8d6f |
|
MD5 | fc827c4ad91793fdc418fc5bd2d90c3b |
|
BLAKE2b-256 | dec149b7d8916e53973c4ec67a69b90453b815a5804851b4f5f143de6fbb7dd8 |
Hashes for streaming_form_data-1.14.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07c1b716486f81a1282e7d5c50caace1d8e5d11ded0ef88874cc5b1f62983f9f |
|
MD5 | 77403eeef9a8267a5ff2ba1832431887 |
|
BLAKE2b-256 | c9453fe144a400dab733882dbdfa20ff4ff84c3f96b25755427ce8f3229fe5b0 |
Hashes for streaming_form_data-1.14.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa8f26b6b1bf1ca5452fc18bad1c40c89c5da1e85786cbfc0d35d4b6991e1a05 |
|
MD5 | 3a42a80b9e18a432fdb28d669a61fbca |
|
BLAKE2b-256 | c77eba87a8075d25fbcb3d8f97a92b83b733ea13157d6fe868eb504b4f525881 |
Hashes for streaming_form_data-1.14.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cf5e84bac15cd59af8a7d4ca57c8d41914723cca3f77b06d0d7895ea11d6b13 |
|
MD5 | e2dd74209e1a27d2616c6a216b55b2c2 |
|
BLAKE2b-256 | 6f9ca7f961cc8133c129cadfe4913422d8596b4687de96b2a1ec2429439966ea |
Hashes for streaming_form_data-1.14.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b194d7f7c2d4898f721801a8da873022bb25c1d08b04cf0cc8e8e19b11c6a5ab |
|
MD5 | 7d986d2278e5a05d8c20d6e3df0cb23e |
|
BLAKE2b-256 | fd67c4cd95686f87b5da6f5ac3772ace1d9e362b3b334e398caa0531facabb99 |
Hashes for streaming_form_data-1.14.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d057106359bc0dab9aa7917107009aeceb4b7873b34aaf5a5a323bc2f4fa1c6 |
|
MD5 | 27aeb9f573a04d70a7aaf17f1f229cb2 |
|
BLAKE2b-256 | ca9a297a7089470414461577445d37688ef781ef22f4dcd7ca66bd326ed8de4e |
Hashes for streaming_form_data-1.14.0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46664a22ebb4b08fcf3a54710a90b9c1ad7b5bf5644aeebcb6a0471a2ccb1bc1 |
|
MD5 | cdc5f7eaf61d0d020985afa0f6634fda |
|
BLAKE2b-256 | 46688207300c1a084159033f704489ee19a3b97e6f47253e396436e8c893fe52 |
Hashes for streaming_form_data-1.14.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c5926ae64586beb0df78659f12917ce0e67d022386a05eb1768095ed7faaf72 |
|
MD5 | cc4007a28d4a66112ec0b0ba70982059 |
|
BLAKE2b-256 | 98e3cd5ec965b1ada62677e9bbe33b82b95fd9eedae7c80a095afe347648179b |
Hashes for streaming_form_data-1.14.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 639c1f770aac8739fa1c6b33797521875588ff953ddc294e31238a2fde1f9490 |
|
MD5 | 5f3b0de29cd6111c68ab8ac6c34e552e |
|
BLAKE2b-256 | 236e494d0636b423176986c7f2c1350ac6145a6ff1b61bf97f7e0a3e65c9d321 |
Hashes for streaming_form_data-1.14.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d6fe15bf17efe7b1fae208c26465cc6621ee20848057f4b031c6bebc71ef71b |
|
MD5 | 3f013c6dc064b998ba0bd6e1d2d20d1c |
|
BLAKE2b-256 | a48ad9bb6210da389341612a3cbbdc6dbd3fadda2ed83c574cb4c2008a933a31 |
Hashes for streaming_form_data-1.14.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18037f41422a1897a7b11a5dd456d12e321e9864dbd1889522966858940589f |
|
MD5 | f69f25ac23ded02192d29b32b630f474 |
|
BLAKE2b-256 | e6246fc7d5d608c19eb999aadcdb127b70dce659cb648e9be450fb34c0bd6f26 |
Hashes for streaming_form_data-1.14.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8e6760a9682b0616ec02b28a533a4f1de103b3b8755c8ee6b629b652cc9b6e5 |
|
MD5 | 34922864c887c450beb35da4fafd02bb |
|
BLAKE2b-256 | ae21a0674c85be668a6730fe2a14649b887f12dc71f5c870a47515516f53899a |
Hashes for streaming_form_data-1.14.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b68d35a4fcddda348f0efa10fa17dbee21a6800329932cb714cf3a392fb3741 |
|
MD5 | f83c25ae0d905adb849b5a9d7a399efd |
|
BLAKE2b-256 | 6540698bbe88b79377b0c742703aea9cca3b0ce26199af4c99974751e9a0a1f7 |
Hashes for streaming_form_data-1.14.0-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b0949e897b2be67b9d100d0041921ec703748675138dcd62dcae6cf1b556624 |
|
MD5 | bee99ac1d9f9d601592ef373629ab4d0 |
|
BLAKE2b-256 | d3d4d4a342ec37c1d8699a264d9d0227b833877265e6fce8d9d5a6a148368a02 |
Hashes for streaming_form_data-1.14.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 183c8eaaac2f968a482856c9357737e432e43be0a4cbcc7eff47f75b11a5d0e2 |
|
MD5 | 8c3b24cf837c231ed669295b7c5fbb38 |
|
BLAKE2b-256 | a5679e5067778b187c03249b614912e3f4913a1ededd14b71f488bb88bb3165c |
Hashes for streaming_form_data-1.14.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99ee3c5e129f38b29cc1653f95ecc6aa9d225d27e3ad1fc272e9a4c30252d65f |
|
MD5 | b14b36a139ff6939415f9f921ad5ac88 |
|
BLAKE2b-256 | 824e4a8965fc1d6531c1bd81c481a0e6fef24f73f36f600fca7171692d1cf1da |
Hashes for streaming_form_data-1.14.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 641f7014058c584e4e0da68bf53e2f3223fa8a5cd22560695c93cb253dd25eef |
|
MD5 | 9a45fd707e419a296138e9e37e0860e1 |
|
BLAKE2b-256 | 4ffcef2210b85da252bcbf07a6866e16e04c0f32547cbfd5df9533a5015585e7 |