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.6+

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

Uploaded Source

File details

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

File metadata

  • Download URL: mangum-0.6.6.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.6.8rc1

File hashes

Hashes for mangum-0.6.6.tar.gz
Algorithm Hash digest
SHA256 7b94f96866ccef33de1e63ea75ef6a404f521aa4c93344b3db0dab7cb69c2d6e
MD5 b6f46d98f7a38d30ed07ab0b1569a6e9
BLAKE2b-256 0ef5d2eadec4ce4ec132bd2157d870d4fb0f8c9ae865edb313f9610cbf4094c5

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