1
1
Fork
You've already forked multipart
0
A fast multipart/form-data parser for python
  • Python 99.5%
  • Makefile 0.5%
2026年07月11日 09:41:07 +02:00
.github build: Upgraded actions versions 2026年03月14日 10:42:58 +01:00
docs change: PushMultipartParser now emits bytes instead of bytearray 2026年06月13日 14:00:47 +02:00
examples Added examples folder and AsyncMultipartStreamWrapper example. 2026年07月11日 09:41:07 +02:00
test perf: Fast-path for common Content-Disposition headers. 2026年07月07日 16:59:32 +02:00
.gitignore Cleanup .gitignore 2025年07月26日 16:36:09 +02:00
.readthedocs.yaml build: Fix readthedocs build config 2026年06月06日 16:06:24 +02:00
CHANGELOG.rst docs: Changelog 2026年07月11日 08:36:00 +02:00
LICENSE Docstrings, typos and formatting 2026年04月11日 17:33:30 +02:00
MAINTAINERS.rst Add myself to a new MAINTAINERS.rst file 2020年11月12日 00:06:52 +00:00
Makefile docs: Lots of work on docs and docstrings 2024年11月27日 15:09:34 +01:00
multipart.py Minor cleanup 2026年07月07日 18:27:14 +02:00
pyproject.toml build: Move 'dev' and 'docs' to dependency-groups where they belong. 2026年03月14日 10:32:41 +01:00
README.rst Docstrings, typos and formatting 2026年04月11日 17:33:30 +02:00

Python multipart/form-data parser

Tests Status

Latest Version

Supported Python 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: Spend 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).