mangum is a free, open source api development & testing project written in Python and released under MIT. It has 2,137 GitHub stars, 135 forks and 38 open issues, and was last pushed 14 days ago. On this registry it ranks #97 of 154 tracked projects in API Development & Testing, with 5 head-to-head comparisons available.

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")

Frequently asked questions

Is mangum free to use?

mangum is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does mangum do?

AWS Lambda support for ASGI applications

What is mangum written in?

mangum is primarily written in Python. Its source is publicly available at https://github.com/Kludex/mangum, and it has 2,137 GitHub stars.