Skip to main content

Streaming parser for multipart/form-data

Project description

Streaming multipart/form-data parser

image image Downloads Ruff

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

Thanks a lot for your fix with streaming-form-data. I can finally upload gigabyte sized files at good speed and without memory filling up!

huge thanks to @siddhantgoel with his "streaming-form-data" that saves me from the slow file reads I get with @FastAPI!

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, GCSTarget, S3Target, ValueTarget
>>>
>>> headers = {"Content-Type": "multipart/form-data; boundary=boundary"}
>>>
>>> parser = StreamingFormDataParser(headers=headers)
>>>
>>> parser.register("name", ValueTarget())
>>> parser.register("file-local", FileTarget("/path/to/file.txt"))
>>> parser.register("file-s3", S3Target("s3://bucket/path/to/key"))
>>> parser.register("file-gcs", GCSTarget("gs://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.10+, uv, and task 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.

  1. Git clone the repository: git clone https://github.com/siddhantgoel/streaming-form-data

  2. Install the packages required for development: uv sync

  3. That's basically it. You should now be able to run the test suite: task test

Note that if you make any changes to Cython files (.pyx, .pxd, .pxi), you'll need to re-compile (task compile) and re-install streaming_form_data before you can test your changes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streaming_form_data-2.0.0.tar.gz (149.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

streaming_form_data-2.0.0-cp313-cp313-win_amd64.whl (207.0 kB view details)

Uploaded CPython 3.13Windows x86-64

streaming_form_data-2.0.0-cp313-cp313-win32.whl (196.9 kB view details)

Uploaded CPython 3.13Windows x86

streaming_form_data-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl (639.1 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

streaming_form_data-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (651.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

streaming_form_data-2.0.0-cp313-cp313-macosx_11_0_arm64.whl (220.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

streaming_form_data-2.0.0-cp312-cp312-win_amd64.whl (207.5 kB view details)

Uploaded CPython 3.12Windows x86-64

streaming_form_data-2.0.0-cp312-cp312-win32.whl (197.1 kB view details)

Uploaded CPython 3.12Windows x86

streaming_form_data-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl (645.8 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

streaming_form_data-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (658.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

streaming_form_data-2.0.0-cp312-cp312-macosx_11_0_arm64.whl (221.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

streaming_form_data-2.0.0-cp311-cp311-win_amd64.whl (207.6 kB view details)

Uploaded CPython 3.11Windows x86-64

streaming_form_data-2.0.0-cp311-cp311-win32.whl (198.1 kB view details)

Uploaded CPython 3.11Windows x86

streaming_form_data-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl (650.7 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

streaming_form_data-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (657.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

streaming_form_data-2.0.0-cp311-cp311-macosx_11_0_arm64.whl (221.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

streaming_form_data-2.0.0-cp310-cp310-win_amd64.whl (207.1 kB view details)

Uploaded CPython 3.10Windows x86-64

streaming_form_data-2.0.0-cp310-cp310-win32.whl (197.8 kB view details)

Uploaded CPython 3.10Windows x86

streaming_form_data-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl (612.4 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

streaming_form_data-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (622.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

streaming_form_data-2.0.0-cp310-cp310-macosx_11_0_arm64.whl (220.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file streaming_form_data-2.0.0.tar.gz.

File metadata

  • Download URL: streaming_form_data-2.0.0.tar.gz
  • Upload date:
  • Size: 149.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for streaming_form_data-2.0.0.tar.gz
Algorithm Hash digest
SHA256 cab18e7b5d31e79ac6ec71a5f2e880aafdd90321bd2197955fd7fdbd7f3e2101
MD5 6ac366ca5f3268ab6e0139b4ddfc5c08
BLAKE2b-256 41920006dbc72b9d6623a3304f75d58601714d2cc0d0476406076527a9eb3c9b

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a26c7acf0a3a014206ba33e6e03a8d0a330ea02f2b729946466ffcc97ef3207b
MD5 202a1914fab7a5738acab71f98d1dc02
BLAKE2b-256 5c3062b136709d91a8116658237b2148ba070f2323c5dbd18be7461bd139a0cf

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 451da7907a7edc83a9d9960d8aa740307022f482ad1f4181c9ea56a9a33f4457
MD5 bd1a60f4cc1e490a54a44f77d7c3d0b0
BLAKE2b-256 dbe9359c7e2f67bff941de18739cfb43b588a9855622f796adbd522b68a41a02

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7d13225fc2ea715b3281e4ef1f863d8844be2cb6e1ceb3c677dd9d82ff52949b
MD5 6f0a122903d69c1821ecccd8d3ab6ea6
BLAKE2b-256 832bde13e1cd2c40a2c127c4cae94cee0209fa6f89783ee87ce9f8d961cd9075

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 35f85c469ebb98c61ad1b4d7c247833e5baa7a828003a0e0edd7137c8823ba03
MD5 7048226f0fff933f717688e183cd3465
BLAKE2b-256 d50eaeb83eadd7fcfca1f661068157c8438178e93a218b82bc0acaa510174fa9

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35df9de771dfdebd9987c3212659f09678e205aca290745b816b6cae70fcbc92
MD5 cc4b5866cf3471776659df4ee720f4eb
BLAKE2b-256 67dc41e01ef924646595bdacdf9fc56d480ebfe4d2f91ab719baf58a28e0aa33

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7caf5c436bef5411baf210cd3ec77fe1764930462fecf6d523a0c82535fa03be
MD5 f1776010e94db83f60a336fbf462243d
BLAKE2b-256 83cc6176c9a1adbeb9212468615458e82af2b22da5bab2ca908241018a52c64e

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 267fb3176745b7e8330082fa644f7a0b396fedf15eee5ace9cf4a06a667af54c
MD5 0c4344f6ce63146548d82bcbff473480
BLAKE2b-256 0436e8b8027ca20346b01b7f845b043d31980813f5f848e19e11d7dde176b1e7

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4c04bdf9ba1bdd8695f48f7853d2692c7924debb69eabec1bb4babc611ac7ed5
MD5 612cae877480af94c3d5baea433792e4
BLAKE2b-256 85e85f8fcbc512e5a741c0cb80bc3a9628bce60effef6e198bbf8cefcc375371

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 e7bdbf78a5c44b2d1816300f5b461138c33efde774560e849c36302077dfe9a3
MD5 8b300f6f00c4268d5f4565c5f4ca5626
BLAKE2b-256 97dd60fa73288c6ae6e4c227b6a407491ee2852382d5140f508de3d8f5cd6418

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cebbcdf31e38bb3569d5cafc2f8cbcf9b8da5298eaff2464b5ba224abc915a29
MD5 83ffad6a7075cc7aeb2555bf648fc05a
BLAKE2b-256 1e6c0ead45b983a0b4eefa52ac7c8647980c456edb8e8c41e31b97141eded033

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dd6853c3ffd9225337871ff9c0a8142d6e4d567e235f66b07486d255e4a5840c
MD5 7585c38c22f81782c4c0476da041f124
BLAKE2b-256 7c803f9ed76130a932487e74ff490361ba3feb5f1e929a4e51e40794514dde24

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5a075c37c7c121585d21a1719ff32438ff295022d86595c0e855dc63166a6c35
MD5 4eccd4ccd186db018cb5e770ff980881
BLAKE2b-256 087bac0946350d85e062c0a1dc49496fe4b656765f02159817c902ac5f538696

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6de9e07a2b2636065037c48570794fdcb74f92bd0a2d29c51814c05b01a5c5f6
MD5 1df589d62541f342d2147db6f4cdd301
BLAKE2b-256 0f520a0307a5881b9c410c42a2d54e818ed2d68318476700c987b1ea6938e0ea

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 0939d5ea9c59f535efbdf8a6a136f7a8766a2907a2563d17cfb8006e7e1ce128
MD5 92d18ebc1a42872d20e10b568df74f93
BLAKE2b-256 8c6787be6bef7c7476f21eac64f1d025d8187fcf9b6e0ecceeb717746bc7a6cc

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3e02b873847adc383891379d5774095fc6d463f2b77acd62315434b5c4cc1341
MD5 9793218b12d808fbb0205a3cdac0f366
BLAKE2b-256 4acab4c45661effe918447c1997a8dd54cacf4c3c29603639fbbb04407c6d5e9

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e7ba7804f8765f2dd18bb23599bf2fd48a59c881f93da78d83f93eac17a69332
MD5 3d61fbf6eacc16115983fb9721698eeb
BLAKE2b-256 a4fecf4d807b4d15d49f13861b723ec81a48cc1ab45498e1c97d79a57ed935d4

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b34c275171c984814facd387d4fe0868bec6756c8e780c1f10c67476899269ec
MD5 4214bcef9d5b98ea285adff2ac83b907
BLAKE2b-256 315a52a5741fa0bf4efdc5a41a86531d2b4b7c0631e183f0698d54213c222e42

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 513c388b2a3af384bb1bc5cfbd642f431fe8a506375c1614a8d9c28f0dbc7f5f
MD5 e3b042de452324f56558aaf94e70ad9c
BLAKE2b-256 1c74e450cca66e29b7226db16be842af510bac153e7f61d32c3d2114634c610a

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 19e7779cfe8ea20817bd2599534d2afdb8fae0bf8a9bd73063c52f5b9a6552dc
MD5 f86f6f43f641175871d0d385e65b8b33
BLAKE2b-256 b2d1c02ec79434029ec57163b61889030738314f5ce1ad456ee1961b4d2105e1

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.0.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for streaming_form_data-2.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e23c88384e16d7177b3a792bfcc09bf4ca9bc4b4c4b0853bd3057e644a8a4b78
MD5 096ef4f8a79e86a11d41984e13e8d804
BLAKE2b-256 88133ed2908b747eeb8d97c7c75a9b278fbd87a87150ea00c00a1e45cfb7f412

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page