mangum

AWS Lambda support for ASGI applications

74 个版本 Python >=3.9
安装
pip install mangum
poetry add mangum
pipenv install mangum
conda install mangum
描述

Mangum

Package version PyPI - Python Version

Mangum is an adapter for running ASGI applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.

Documentation: https://mangum.fastapiexpert.com/

Features

Installation

pip install mangum

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, lifespan="off")

Or using a framework:

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")
版本列表
0.21.0 2026-02-01
0.20.0 2025-12-27
0.19.0 2024-09-26
0.18.0 2024-09-20
0.18.0a1 2024-09-20
0.17.0 2022-11-27
0.16.0 2022-10-26
0.15.1 2022-08-07
0.15.0 2022-04-24
0.14.1 2022-03-07
0.14.0 2022-03-03
0.13.0 2022-02-25
0.12.4 2022-02-07
0.12.3 2021-10-06
0.12.2 2021-08-11
0.12.1 2021-07-23
0.12.0 2021-07-16
0.11.0 2021-03-19
0.10.0 2020-10-03
0.10.0b1 2020-06-28
0.9.2 2020-05-19
0.9.1 2020-05-16
0.9.0 2020-05-09
0.9.0b1 2020-05-03
0.8.0 2020-04-18
0.7.5 2020-04-12
0.7.4 2020-02-14
0.7.3 2020-02-08
0.7.2 2020-02-08
0.7.1 2020-02-08
0.7.0 2020-01-07
0.6.19 2019-12-02
0.6.18 2019-11-22
0.6.17 2019-10-20
0.6.16 2019-08-21
0.6.15 2019-08-07
0.6.14 2019-08-01
0.6.13 2019-07-31
0.6.12 2019-07-31
0.6.11 2019-07-23
0.6.10 2019-07-21
0.6.9 2019-07-20
0.6.8 2019-07-20
0.6.7 2019-02-03
0.6.6 2019-02-02
0.6.5 2019-01-30
0.6.4 2019-01-29
0.6.3 2019-01-28
0.6.2 2019-01-28
0.6.1 2019-01-28
0.6.0 2019-01-28
0.5.9 2019-01-28
0.5.8 2019-01-28
0.5.7 2019-01-28
0.5.6 2019-01-28
0.5.5 2019-01-28
0.5.4 2019-01-28
0.5.3 2019-01-27
0.5.2 2019-01-27
0.5.1 2019-01-27
0.5.0 2019-01-26
0.4.7 2019-01-26
0.4.5 2019-01-26
0.4.0 2019-01-26
0.3.0 2019-01-26
0.2.6 2019-01-20
0.2.2 2019-01-20
0.2.1 2019-01-20
0.2.0 2019-01-20
0.1.0 2019-01-19
0.0.6 2019-01-19
0.0.4 2019-01-17
0.0.3 2019-01-16
0.0.2 2019-01-16