Skip to main content

ASGI serverless adapters

Project description

Mangum

Documentation: https://erm.github.io/mangum/

Package version Build Status

Mangum is a library for using ASGI applications with FaaS platforms.

Requirements

Python 3.6+

Installation

$ pip3 install mangum

Supported Platforms

Only two platforms are currently supported, but if you'd like to see others, please open an issue.

AWS Lambda / API Gateway

To make an ASGI application compatible with AWS Lambda & API Gateway, wrap it with the AWSLambdaAdapter:

from mangum.platforms.aws.adapter import AWSLambdaAdapter
from yourapp.app import app


handler = AWSLambdaAdapter(app)  # optionally set debug=True

You would then need to specify <path>.handler in your AWS Lambda configuration.

Note: This platform adapter can also use an optional debug argument to return unhandled errors raised by the application. It should NOT be enabled outside of development.

An example application can be found here.

Azure Functions

Similarly as above, wrap the application with the AzureFunctionAdapter:

from mangum.platforms.azure.adapter import AzureFunctionAdapter
from yourapp.app import app


handler = AzureFunctionAdapter(app)

An example application can be found here.

Dependencies

The base install does not have any hard requirements, but there are dependencies required depending on platform:

azure-functions - required for Azure Function support. Can be installed using:

$ pip3 install mangum[azure]

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.4.tar.gz (5.8 kB view hashes)

Uploaded Source

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