Skip to content

AWS Lambda support for ASGI applications

License

Notifications You must be signed in to change notification settings

tlaundal/mangum

Repository files navigation

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.

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 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]

About

AWS Lambda support for ASGI applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Shell 0.4%