Serverless ASGI
Project description
Mangum
Mangum is a library for using ASGI applications with AWS Lambda & API Gateway.
Requirements
Python 3.6+
Installation
$ pip3 install mangum
Example
from mangum import Mangum
class App:
def __init__(self, scope):
self.scope = scope
async def __call__(self, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
handler = Mangum(App) # optionally set debug=True
You would then need to specify <path>.handler
in your AWS Lambda configuration.
Frameworks
Any ASGI framework should work with Mangum, however there are cases where certain non-ASGI behaviour of an application will causes 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
mangum-0.6.5.tar.gz
(3.4 kB
view details)
File details
Details for the file mangum-0.6.5.tar.gz
.
File metadata
- Download URL: mangum-0.6.5.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.6.8rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e629c637e91eb7b12b34bd0c6e5e1028a90448827eaa043769169d6a5394a2 |
|
MD5 | 0c39d9f4433ecfeed0c3b474020276d2 |
|
BLAKE2b-256 | 46edb86a7f9a5ad7a44cd9534f143a05723c14bfff2716501d022992e1b8960d |