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

Uploaded Source

File details

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

File metadata

  • Download URL: mangum-0.6.3.tar.gz
  • Upload date:
  • Size: 5.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/40.6.2 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.6.8rc1

File hashes

Hashes for mangum-0.6.3.tar.gz
Algorithm Hash digest
SHA256 a5b36f72c7136d74dd45c47453e9640296882a422d797134dbf43a3c60b06b66
MD5 c82b2b86a81437fb0b0487a0ed10562d
BLAKE2b-256 7add13cbd3ce1a11b7025ff3b304dba6a709a848e5da579c3d96e81a1569d0c9

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