The Wayback Machine - https://web.archive.org/web/20220226220444/https://github.com/jordaneremieff/mangum
Skip to content
main
Switch branches/tags
Code

Latest commit

…ing additions and fixes, refactoring. (#242)

* 🎨 Replace abstract handlers and introduce provisional support for custom handlers, various type annotation fixes and additions, remove dataclasses, update README and requirements.

* đź’Ą Drop support for Python 3.6.
7ee6846

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mangum

Package version Build Status

PyPI - Python Version

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

Documentation: https://mangum.io/

Features

Requirements

Python 3.7+

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)

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)