{"id":28956833,"url":"https://github.com/developmentseed/asgi-s3-response-middleware","last_synced_at":"2025-06-23T21:40:57.727Z","repository":{"id":255443135,"uuid":"851979021","full_name":"developmentseed/asgi-s3-response-middleware","owner":"developmentseed","description":"ASGI Middleware to spill large responses over to S3.","archived":false,"fork":false,"pushed_at":"2024-09-05T16:48:52.000Z","size":56,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-20T22:35:05.417Z","etag":null,"topics":["asgi","fastapi","fastapi-middleware","s3","starlette","starlette-middleware"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developmentseed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T02:33:08.000Z","updated_at":"2024-11-06T22:52:29.000Z","dependencies_parsed_at":"2024-09-04T03:22:34.984Z","dependency_job_id":"411fcf8b-40c4-4dab-b79e-9e97d6a9bfc8","html_url":"https://github.com/developmentseed/asgi-s3-response-middleware","commit_stats":null,"previous_names":["developmentseed/asgi-s3-response-middleware"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/developmentseed/asgi-s3-response-middleware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fasgi-s3-response-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fasgi-s3-response-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fasgi-s3-response-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fasgi-s3-response-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developmentseed","download_url":"https://codeload.github.com/developmentseed/asgi-s3-response-middleware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developmentseed%2Fasgi-s3-response-middleware/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261561183,"owners_count":23177545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asgi","fastapi","fastapi-middleware","s3","starlette","starlette-middleware"],"created_at":"2025-06-23T21:40:57.480Z","updated_at":"2025-06-23T21:40:57.702Z","avatar_url":"https://github.com/developmentseed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003c!-- Consider using a logo image:\n  \u003cimg width=\"500\" alt=\"logo-description\" src=\"https://github.com/developmentseed/asgi_s3_response_middleware/assets/10407788/fc69e5ae-4ab7-491f-8c20-6b9e1372b4c6\"\u003e\n--\u003e\n  \u003ch3 style=\"font-family: monospace\"\u003eASGI S3 Response Middleware\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eMiddleware to spill large responses over to S3.\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n\u003c!-- **Documentation**: \u003ca href=\"TODO...\" target=\"_blank\"\u003eTODO...\u003c/a\u003e --\u003e\n\n**Source Code**: \u003ca href=\"https://github.com/developmentseed/asgi-s3-response-middleware\" target=\"_blank\"\u003ehttps://github.com/developmentseed/asgi-s3-response-middleware\u003c/a\u003e\n\n---\n\n## Usage\n\nAn ASGI middleware class to automatically push repsonses S3 and instead return a 303 redirect to the object on S3.\n\nThis 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](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n\n### Example\n\n```py\nimport uuid\nimport boto3\nfrom fastapi import FastAPI\nfrom asgi_s3_response_middleware import S3ResponseMiddleware\n\ns3_client = boto3.client('s3')\n\napp = FastAPI()\n\napp.add_middleware(\n    S3ResponseMiddleware,\n    s3_bucket_name='my-example-bucket',\n    s3_client=s3_client,\n    key_generator=lambda: f\"responses/{uuid.uuid4()}\",\n    size_threshold=2 * 1024**2,  # 2MB\n    url_expiry=30,  # 30 seconds\n)\n```\n\n## Development\n\n### Releases\n\nReleases are managed via CICD workflow, as described in the [Python Packaging User Guide](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/). To create a new release:\n\n1. Update the version in `src/asgi_s3_response_middleware/__init__.py` following appropriate [Semantic Versioning convention](https://semver.org/).\n1. Push a tagged commit to `main`, with the tag matching the package's new version number.\n\n\u003e [!NOTE]  \n\u003e This package makes use of Github's [automatically generated release notes](https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes). These can be later augmented if one sees fit.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fasgi-s3-response-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopmentseed%2Fasgi-s3-response-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopmentseed%2Fasgi-s3-response-middleware/lists"}