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.1.0.tar.gz (150.9 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.1.0-cp313-cp313-win_amd64.whl (207.9 kB view details)

Uploaded CPython 3.13Windows x86-64

streaming_form_data-2.1.0-cp313-cp313-win32.whl (197.9 kB view details)

Uploaded CPython 3.13Windows x86

streaming_form_data-2.1.0-cp313-cp313-musllinux_1_2_x86_64.whl (647.6 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

streaming_form_data-2.1.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (660.3 kB view details)

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

streaming_form_data-2.1.0-cp313-cp313-macosx_11_0_arm64.whl (222.3 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

streaming_form_data-2.1.0-cp312-cp312-win_amd64.whl (208.5 kB view details)

Uploaded CPython 3.12Windows x86-64

streaming_form_data-2.1.0-cp312-cp312-win32.whl (198.1 kB view details)

Uploaded CPython 3.12Windows x86

streaming_form_data-2.1.0-cp312-cp312-musllinux_1_2_x86_64.whl (651.4 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

streaming_form_data-2.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (664.2 kB view details)

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

streaming_form_data-2.1.0-cp312-cp312-macosx_11_0_arm64.whl (223.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

streaming_form_data-2.1.0-cp311-cp311-win_amd64.whl (208.6 kB view details)

Uploaded CPython 3.11Windows x86-64

streaming_form_data-2.1.0-cp311-cp311-win32.whl (198.5 kB view details)

Uploaded CPython 3.11Windows x86

streaming_form_data-2.1.0-cp311-cp311-musllinux_1_2_x86_64.whl (657.8 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

streaming_form_data-2.1.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (664.3 kB view details)

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

streaming_form_data-2.1.0-cp311-cp311-macosx_11_0_arm64.whl (223.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

streaming_form_data-2.1.0-cp310-cp310-win_amd64.whl (208.1 kB view details)

Uploaded CPython 3.10Windows x86-64

streaming_form_data-2.1.0-cp310-cp310-win32.whl (198.3 kB view details)

Uploaded CPython 3.10Windows x86

streaming_form_data-2.1.0-cp310-cp310-musllinux_1_2_x86_64.whl (617.0 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

streaming_form_data-2.1.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (626.9 kB view details)

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

streaming_form_data-2.1.0-cp310-cp310-macosx_11_0_arm64.whl (221.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for streaming_form_data-2.1.0.tar.gz
Algorithm Hash digest
SHA256 2c5c81fc9c451ea133083bc6da959f87e9b91fba3effe99411f1f90461ea7c5b
MD5 1f4c0cc870c430bab8cfe76066d91ae9
BLAKE2b-256 dcfdd49f3b4e6258e865566fd8aa3da9966f47ca5a7d7fd8ca181f8209010605

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2d688a0205d44441fdd38010f84b32a29668d81537909b2832d0ecdf02b43a2d
MD5 705dfb0db4cfa38b29523cab63aa1528
BLAKE2b-256 d03d77b35bfca81c6cc4546c35b38998c5fde2d5783e3b3a14ceebced1415ed9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 0d92b76a51ef0621b37c437deae8641589e21ff3b132a407b146753a7b7f6576
MD5 613c60242e00b6b6bed40ae3aa9ba21a
BLAKE2b-256 2dcb1ea4254bc0cf107a0d853ccb3aca5f2db41f238de2e8b0dc7b55b51d114a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 28209064b60d86ff065b2a0776adccebd849beb2507e7f9cb995597ae2d30980
MD5 3e245634df1fdb7df34fa0990aed865d
BLAKE2b-256 7e1fc8cffb5d4ce2d9fb02bd0190f66b682405e972e09a22517dd11a0f08f6bf

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.1.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.1.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 a917c93e45df1e7296964f46a98ef4a73ab477c10cebe1abb2667c90983f4d73
MD5 49fb3519d022af11ecb967be0486e05c
BLAKE2b-256 b7b40db7ffb320710b851ec290eedbbc5875a3e2b82fae3418632ac860c25b31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7841684f9ac6476cfb0288ab670c2b08b1f1a06ddcac67b851843c5e53b27b7
MD5 30cb1cf73dfe9f827ff3af742c2f9d8d
BLAKE2b-256 134b6da0657b08df77c9b3399273976e7bde90b9156254bf6237d0d84dd440bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 76c36952a7399167984e0146b1dcd50fcd58e4adf58c28cb8150bd2973c5f8d5
MD5 9edc12dd054cbbe11102946373fcc033
BLAKE2b-256 f9a553c01f6d0474d53bfdb9f32ffe6946101b499f6c698dd61ac560eace72be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 a08266f5328071d2b57c43448cacefbaf80ab5e33e3020401f064f688e748dbc
MD5 2c1324544bac813e6947a9c4e30ee900
BLAKE2b-256 e00f80db74a30563758768550276cb6b07d6e9248c24176cfb1f021abf47860c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 055d40c7a03d56de9751167a95b62176f9b2283c808d4818f78b0ae4b872d166
MD5 7fb43b816403df315e2a390c405f05cd
BLAKE2b-256 063b7c69ce4977a81a4e02221abd73c7de8a2e2f34a53987f64c041d2920d706

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.1.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.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 c10cc7dc41c79ea270ad93d1f1dc982750eb5b13f719d9a978f125c0b3b86371
MD5 8f5224d479e4cb9ffd0e1031ab1a5c83
BLAKE2b-256 0931335732ff6f370eeb42391505a2d08c32ec5381b846cd619a4e58b2cbdad2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 109390324580f0bab0777f9f347843c29895aa78028aed86e5931158008ef369
MD5 74fc2c1ad2650815a82ad42f4d67dbb4
BLAKE2b-256 a4b23123dc2b39ff69a5cf7bea5fb2a0a7aa2b41c4c43d3c489eada7cc249873

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 582912c9f488569ec8d7930d73abedbeb96dd74ea447b7d6fa4691e730276884
MD5 66961f049364830e6b4ad06acd141066
BLAKE2b-256 bc6b2cd860cec26b65d1d65a1e371cb1fb094aa15a0cee6235f996d32c49fe22

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 c9d17aaae0a171f74611cd2bead3dc39bf3cd5f02887af67aa8d4da5b3647022
MD5 f3136931026465ad8d8eca70f8368760
BLAKE2b-256 55b52bb7a12abdd81bccd311a12fbabe8c715774e2d99a12cedf0c294179154b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ab74a306ac7db0fc8a4539c62b55db0488d2f81928648a66ccfa0770051cc4f7
MD5 08afe7a50e1611ce6a45fc45b50d22ed
BLAKE2b-256 ef69e50cd2c4fc8e216d7a6a073eea4239f744db8bf556b93fd8671b23e47358

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.1.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.1.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 97934de76c520182e8536748c8f07544d646777174a41215ee15c3eeca0de479
MD5 276a3a36ffe58098ebd927e4673f88b0
BLAKE2b-256 0b110e3490b9ff2dc14dbff8baacf1c23c15f24f8ad3434327022b5f59e50e2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a94d5eb98399fa9bd69741a4fb784d92ea8a774850e099a4bb6bb5812d773ed7
MD5 92d7aeb10a51bac8944c70c164e1b800
BLAKE2b-256 909a9239a3e8c6fb10e0367c3aec387eed816cc9fe411a43cd998203d269e3f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a5b46ea82530e4f9be08396b388e38e3b89f26345a19e2f84ade0302d92cc5dc
MD5 e7bc14238aefcfe7d849ae1599b99d9c
BLAKE2b-256 d5e2abd0b2b1772a91bfb979d52d5ddd5a70a1ed62506b0cd23c8450dd2c1f4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 0ef2778e554bc7db29f6493d229d2eea647f5df8b104cf017516a9bbf5e869fc
MD5 b0ab3467ec1d8d5b61fb024c414552d3
BLAKE2b-256 b396e94f0ace935a23011ff44e3d0f9b88950159fd02b45a1528c3b57ef73876

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 233026ea931b4043ddec64dc774753073a03caee5f76be450ceb73e15c31d016
MD5 4cdf4b83ff2ef35c0158320133a0eacc
BLAKE2b-256 a977421e4437fb8eaee7c8396ea5a5d2d54ff22b96279dbae4cb251539824933

See more details on using hashes here.

File details

Details for the file streaming_form_data-2.1.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.1.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b2269ddc234673d8b99863d0203f12d6127eda96d4c4155ae5728b9862f05c5e
MD5 0ce27ac120a10341e03df55bc9d90b58
BLAKE2b-256 019eb71dd002d62a80e3f4ebcd6dba42a07ee180b7d800625e4e101b227b5013

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streaming_form_data-2.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7efb67a2bf91419468f8c84d89fc997f0443ca7640efd2e4ebf31656253627a6
MD5 4b4a8a06681ef03e80944b7e9468599d
BLAKE2b-256 71189bf597fd18a2a16c24981afa6ded6dde18d329c5959bf2d060d695d9a144

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