Warning
Disclaimer: This is a work in progress and not ready for production use.
This package provides a Sans-IO parser for RFC 7578 multipart/form-data
.
Note
This package is heavily inspired by defnull/multipart.
pip install multipart-parser
from multipart_parser import MultipartParser, MultipartPart, Field
parser = MultipartParser(boundary=b"boundary")
parser.parse(
b'\r\n--boundary\r\n"
b"Content-Disposition: form-data; name=\"user\"\r\n"
b"\r\n"
b"Potato"
b"\r\n--boundary--\r\n"
)
field = parser.next_part()
assert isinstance(field, Field)
assert field.name == '"user"'
assert field.data == "Potato"
I run the project like this:
uv run maturin develop && pytest -vvvs
This project is licensed under the MIT License.