Name | mangum JSON |
Version |
0.18.0
JSON |
| download |
home_page | None |
Summary | AWS Lambda support for ASGI applications |
upload_time | 2024-09-20 18:56:06 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# Mangum
<a href="https://pypi.org/project/mangum/">
<img src="https://badge.fury.io/py/mangum.svg" alt="Package version">
</a>
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/mangum.svg?style=flat-square">
Mangum is an adapter for running [ASGI](https://asgi.readthedocs.io/en/latest/) applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.
***Documentation***: https://mangum.fastapiexpert.com/
## Features
- Event handlers for API Gateway [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) and [REST](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html) APIs, [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html), [Function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html), and [CloudFront Lambda@Edge](https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html).
- Compatibility with ASGI application frameworks, such as [Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [Quart](https://pgjones.gitlab.io/quart/) and [Django](https://www.djangoproject.com/).
- Support for binary media types and payload compression in API Gateway using GZip or Brotli.
- Works with existing deployment and configuration tools, including [Serverless Framework](https://www.serverless.com/) and [AWS SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html).
- Startup and shutdown [lifespan](https://asgi.readthedocs.io/en/latest/specs/lifespan.html) events.
## Installation
```shell
pip install mangum
```
## Example
```python
from mangum import Mangum
async def app(scope, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain; charset=utf-8"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
handler = Mangum(app, lifespan="off")
```
Or using a framework:
```python
from fastapi import FastAPI
from mangum import Mangum
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
handler = Mangum(app, lifespan="off")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "mangum",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Jordan Eremieff <jordan@eremieff.com>, Marcelo Trylesinski <marcelotryle@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5f/7b/0297f416339ba43512bfeea976f5701cfe1ec06709b098c2e54c710aca57/mangum-0.18.0.tar.gz",
"platform": null,
"description": "# Mangum\n\n<a href=\"https://pypi.org/project/mangum/\">\n <img src=\"https://badge.fury.io/py/mangum.svg\" alt=\"Package version\">\n</a>\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/mangum.svg?style=flat-square\">\n\nMangum is an adapter for running [ASGI](https://asgi.readthedocs.io/en/latest/) applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.\n\n***Documentation***: https://mangum.fastapiexpert.com/\n\n## Features\n\n- Event handlers for API Gateway [HTTP](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) and [REST](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html) APIs, [Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html), [Function URLs](https://docs.aws.amazon.com/lambda/latest/dg/lambda-urls.html), and [CloudFront Lambda@Edge](https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html).\n\n- Compatibility with ASGI application frameworks, such as [Starlette](https://www.starlette.io/), [FastAPI](https://fastapi.tiangolo.com/), [Quart](https://pgjones.gitlab.io/quart/) and [Django](https://www.djangoproject.com/).\n\n- Support for binary media types and payload compression in API Gateway using GZip or Brotli.\n\n- Works with existing deployment and configuration tools, including [Serverless Framework](https://www.serverless.com/) and [AWS SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html).\n\n- Startup and shutdown [lifespan](https://asgi.readthedocs.io/en/latest/specs/lifespan.html) events.\n\n## Installation\n\n```shell\npip install mangum\n```\n\n## Example\n\n```python\nfrom mangum import Mangum\n\nasync def app(scope, receive, send):\n await send(\n {\n \"type\": \"http.response.start\",\n \"status\": 200,\n \"headers\": [[b\"content-type\", b\"text/plain; charset=utf-8\"]],\n }\n )\n await send({\"type\": \"http.response.body\", \"body\": b\"Hello, world!\"})\n\n\nhandler = Mangum(app, lifespan=\"off\")\n```\n\nOr using a framework:\n\n```python\nfrom fastapi import FastAPI\nfrom mangum import Mangum\n\napp = FastAPI()\n\n\n@app.get(\"/\")\ndef read_root():\n return {\"Hello\": \"World\"}\n\n\n@app.get(\"/items/{item_id}\")\ndef read_item(item_id: int, q: str = None):\n return {\"item_id\": item_id, \"q\": q}\n\nhandler = Mangum(app, lifespan=\"off\")\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "AWS Lambda support for ASGI applications",
"version": "0.18.0",
"project_urls": {
"Changelog": "https://github.com/Kludex/mangum/blob/main/CHANGELOG.md",
"Documentation": "https://mangum.fastapiexpert.com",
"Funding": "https://github.com/sponsors/Kludex",
"Homepage": "https://github.com/Kludex/mangum",
"Source": "https://github.com/Kludex/mangum"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ef2596b21305063ff9cc609b2a50b178f9bff4dda4fc29e3ce6ce71b91f5c85d",
"md5": "54c5ff54feb228a8a222b8f13ece8743",
"sha256": "cf71aa89bd655d465ece62c9c336be6b537eb297cfc72f7ea463aabc5eda2e6a"
},
"downloads": -1,
"filename": "mangum-0.18.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54c5ff54feb228a8a222b8f13ece8743",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16995,
"upload_time": "2024-09-20T18:56:05",
"upload_time_iso_8601": "2024-09-20T18:56:05.190373Z",
"url": "https://files.pythonhosted.org/packages/ef/25/96b21305063ff9cc609b2a50b178f9bff4dda4fc29e3ce6ce71b91f5c85d/mangum-0.18.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5f7b0297f416339ba43512bfeea976f5701cfe1ec06709b098c2e54c710aca57",
"md5": "026d193aa9f83b61ae74dc1f4349b9d3",
"sha256": "50179395012d9ae3df30484c16280decf0c56fb4c76bd6e1979b9b60135f254f"
},
"downloads": -1,
"filename": "mangum-0.18.0.tar.gz",
"has_sig": false,
"md5_digest": "026d193aa9f83b61ae74dc1f4349b9d3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 86716,
"upload_time": "2024-09-20T18:56:06",
"upload_time_iso_8601": "2024-09-20T18:56:06.686057Z",
"url": "https://files.pythonhosted.org/packages/5f/7b/0297f416339ba43512bfeea976f5701cfe1ec06709b098c2e54c710aca57/mangum-0.18.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-20 18:56:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Kludex",
"github_project": "mangum",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "mangum"
}