Skip to main content

Serverless ASGI

Project description

Mangum

Package version Build Status

Mangum is a library for using ASGI applications with AWS Lambda & API Gateway.

Requirements

Python 3.7+

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

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


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

Uploaded Source

File details

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

File metadata

  • Download URL: mangum-0.6.7.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.1

File hashes

Hashes for mangum-0.6.7.tar.gz
Algorithm Hash digest
SHA256 8559d7c297a0dbc407b43e472eb98de4d0490a10fd2c6e7ce347d03d4eadb02a
MD5 c3bf58a6a73dd6df6e279a92e94edb84
BLAKE2b-256 869e39a09fd577d84e0f47a34ae2da7caa794d1ec08b6c88db32f75952f9152c

See more details on using hashes here.

Provenance

Supported by

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