Skip to main content

Parser for multipart/form-data

Project description

Tests Status Latest Version License

This module provides a fast incremental non-blocking parser for multipart/form-data [HTML5, RFC7578], as well as blocking alternatives for easier use in WSGI or CGI applications:

  • PushMultipartParser: Fast SansIO (incremental, non-blocking) parser suitable for ASGI, asyncio and other IO, time or memory constrained environments.

  • MultipartParser: Streaming parser that reads from a byte stream and yields memory- or disk-buffered MultipartPart instances.

  • WSGI Helper: High-level functions and containers for WSGI or CGI applications with support for both multipart and urlencoded form submissions.

Features

  • Pure python single file module with no dependencies.

  • Optimized for both blocking and non-blocking applications.

  • 100% test coverage with test data from actual browsers and HTTP clients.

  • High throughput and low latency (see benchmarks).

  • Predictable memory and disk resource consumption via fine grained limits.

  • Strict mode: Spent less time parsing malicious or broken inputs.

Scope and compatibility

All parsers in this module implement multipart/form-data as defined by HTML5 and RFC7578, supporting all modern browsers or HTTP clients in use today. Legacy browsers (e.g. IE6) are supported to some degree, but only if the required workarounds do not impact performance or security. In detail this means:

  • Just multipart/form-data, not suitable for email parsing.

  • No multipart/mixed support (deprecated in RFC7578).

  • No base64 or quoted-printable transfer encoding (deprecated in RFC7578).

  • No encoded-word or name=_charset_ encoding markers (deprecated in HTML5).

  • No support for clearly broken clients (e.g. invalid line breaks or headers).

Installation

pip install multipart

Documentation

Examples and API documentation can be found at: https://multipart.readthedocs.io/

License

Code and documentation are available under MIT License (see LICENSE).

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

multipart-1.2.1.tar.gz (36.5 kB view details)

Uploaded Source

Built Distribution

multipart-1.2.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file multipart-1.2.1.tar.gz.

File metadata

  • Download URL: multipart-1.2.1.tar.gz
  • Upload date:
  • Size: 36.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for multipart-1.2.1.tar.gz
Algorithm Hash digest
SHA256 829b909b67bc1ad1c6d4488fcdc6391c2847842b08323addf5200db88dbe9480
MD5 9a8f640620e6b828379d7678d2cd699f
BLAKE2b-256 df916c93b6a95e6a99ef929a99d019fbf5b5f7fd3368389a0b1ec7ce0a23565b

See more details on using hashes here.

File details

Details for the file multipart-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: multipart-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for multipart-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c03dc203bc2e67f6b46a599467ae0d87cf71d7530504b2c1ff4a9ea21d8b8c8c
MD5 f880545400214eea362d2a827432c113
BLAKE2b-256 ccd13598d1e73385baaab427392856f915487db7aa10abadd436f8f2d3e3b0f9

See more details on using hashes here.

Supported by

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