siddhantgoel/streaming-form-data
소개
Streaming (and fast!) parser for multipart/form-data written in Cython
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalStreaming multipart/form-data parser
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
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.
Git clone the repository:
git clone https://github.com/siddhantgoel/streaming-form-dataInstall the packages required for development:
uv syncThat'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.
관련 프로젝트 살펴보기
불러오는 중…