flask-aws-lambda
Python module to make Flask compatible with AWS Lambda for creating RESTful applications. Compatible with both REST and HTTP API gateways.
Installation
pip install flask-aws-lambda
Usage
This module works pretty much just like Flask. This allows you to run and develop this applicaiton locally just like you would in Flask. When ready deploy to Lambda, and configure the handler as:
my_python_file.app
Here is an example of what my_python_file.py would look like:
import json
from flask import request
from flask_aws_lambda import FlaskAwsLambda
app = FlaskAwsLambda(__name__)
@app.route('/foo', methods=['GET', 'POST'])
def foo():
data = {
'form': request.form.copy(),
'args': request.args.copy(),
'json': request.json
}
return (
json.dumps(data, indent=4, sort_keys=True),
200,
{'Content-Type': 'application/json'}
)
if __name__ == '__main__':
app.run(debug=True)
Flask-RESTful
Nothing special here, this module works without issue with Flask-RESTful as well.
API Gateway
Configure your API Gateway with a {proxy+} resource with an ANY method. Your “Method Response” should likely include an application/json “Response Body for 200” that uses the Empty model.
Deploying
Consider using AWS Serverless Application Model (AWS SAM).
Lambda Test Event
If you wish to use the “Test” functionality in Lambda for your function, you will need a “API Gateway AWS Proxy” event. Check the event JSON objects in the events folder.
To update your test event, click “Actions” -> “Configure test event”.
Metadata
Release files for flask-aws-lambda 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flask-aws-lambda-1.0.1.tar.gz | 5.3 kB | Without provenance | Details |
Release files / flask-aws-lambda-1.0.1.tar.gz
| Download URL | flask-aws-lambda-1.0.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24914f99f25c22df20ed075e63209ff153d00403f195bcc79c7c471d1867f55a
|
|
BLAKE2b-256 checksum How to use checksums |
e157994608f252abafed5d400482b1d934bfd1ba22d5890af1817150e58b9104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
|
Security for flask-aws-lambda 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.