ASGI S3 Response Middleware
Middleware to spill large responses over to S3.
Source Code: https://github.com/developmentseed/asgi-s3-response-middleware
Usage
An ASGI middleware class to automatically push repsonses S3 and instead return a 303 redirect to the object on S3.
This can be useful to avoid hitting limits on the size of API response bodies, such as when working around AWS Lambda's 6MB response limit.
Example
import uuid
import boto3
from fastapi import FastAPI
from asgi_s3_response_middleware import S3ResponseMiddleware
s3_client = boto3.client('s3')
app = FastAPI()
app.add_middleware(
S3ResponseMiddleware,
s3_bucket_name='my-example-bucket',
s3_client=s3_client,
key_generator=lambda: f"responses/{uuid.uuid4()}",
size_threshold=2 * 1024**2, # 2MB
url_expiry=30, # 30 seconds
)
Development
Releases
Releases are managed via CICD workflow, as described in the Python Packaging User Guide. To create a new release:
- Update the version in
src/asgi_s3_response_middleware/__init__.pyfollowing appropriate Semantic Versioning convention. - Push a tagged commit to
main, with the tag matching the package's new version number.
[!NOTE]
This package makes use of Github's automatically generated release notes. These can be later augmented if one sees fit.
Metadata
Release files for asgi-s3-response-middleware 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asgi-s3-response-middleware-0.0.4.tar.gz | 3.9 kB | Without provenance | Details for asgi-s3-response-middleware-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asgi_s3_response_middleware-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for asgi_s3_response_middleware-0.0.4-py3-none-any.whl |
Total release size: 8.8 kB
Release files / asgi-s3-response-middleware-0.0.4.tar.gz
| Download URL | asgi-s3-response-middleware-0.0.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e61af5c13198b5c8ef1649dd64d3d2be03ddaf450c63a421a202615d4c3e6a4
|
|
BLAKE2b-256 checksum How to use checksums |
ddea29d849f752fa403912f06353438f5e2783eb3e809bf88c84850791eb704d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / asgi_s3_response_middleware-0.0.4-py3-none-any.whl
| Download URL | asgi_s3_response_middleware-0.0.4-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa80c16347de06e5b16e3596e3807b78f5d77d204b349e9d930364b79ea3eb54
|
|
BLAKE2b-256 checksum How to use checksums |
e6bf5f11c39428037e85bb6bd4a5dd7a97bb98f40b2b72d42456837076d5e880
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for asgi-s3-response-middleware 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.