Skip to main content

AWS Lambda support for ASGI applications

Project description

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

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.21.0.tar.gz (89.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mangum-0.21.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file mangum-0.21.0.tar.gz.

File metadata

  • Download URL: mangum-0.21.0.tar.gz
  • Upload date:
  • Size: 89.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mangum-0.21.0.tar.gz
Algorithm Hash digest
SHA256 e31ed72d67f9958fa4379f65df77729906dec6dfa00afa6ed4e06c77833000de
MD5 7dd230d25a5a12e957b9e393b8e927a2
BLAKE2b-256 89cbd9f4d685a0b8eceac10991e15ac471d9568e4e42c2489ae9bf072828c1c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mangum-0.21.0.tar.gz:

Publisher: publish.yml on Kludex/mangum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mangum-0.21.0-py3-none-any.whl.

File metadata

  • Download URL: mangum-0.21.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mangum-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 309e48f5c629542516c5106ecf079f4ec08809ed50df882238d98fe1392820c7
MD5 043ec087b3b1f2d80a64800f75dc8cc6
BLAKE2b-256 b750e3c694b8e122551e4557450219283771334dee2ed5734a8398c8b8018c50

See more details on using hashes here.

Provenance

The following attestation bundles were made for mangum-0.21.0-py3-none-any.whl:

Publisher: publish.yml on Kludex/mangum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page