AWS Lambda & API Gateway support for ASGI
Project description
Mangum
Mangum is an adapter for using ASGI applications with AWS Lambda & API Gateway.
Documentation: https://erm.github.io/mangum
Requirements
Python 3.7
Installation
pip3 install mangum
Usage
The adapter class Mangum accepts the following optional arguments:
-
enable_lifespan: bool (default=True)Specify whether or not to enable lifespan support.
Example
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, enable_lifespan=False) # disable lifespan for raw ASGI example
WebSockets (experimental)
The adapter currently provides some basic WebSocket support using boto3 with DynamoDB. To install Mangum with the optional dependency:
pip3 install mangum[full]
Frameworks
Any ASGI framework should work with Mangum, however there are cases where certain non-ASGI behaviour of an application will cause issues when deploying to a serverless platform.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mangum-0.6.18.tar.gz.
File metadata
- Download URL: mangum-0.6.18.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46c08209579b492e411c2c3ad004d0b5a29ace517de33bed60e00d60d5b956bf
|
|
| MD5 |
e0d761af74543a4a834a7e9e945374d4
|
|
| BLAKE2b-256 |
ffd30e1aee2fa49c5304b8f478b1cbc17dbc47bbbb59b022862c71978028f101
|