Python module to make Flask compatible with AWS Lambda for creating RESTful applications
Project description
Python module to make Flask compatible with AWS Lambda for creating RESTful applications.
Installation
pip install flask-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:
from flask_lambda import FlaskLambda app = FlaskLambda(__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)
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 python-mu.
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
Built Distribution
File details
Details for the file flask-lambda-0.0.1.tar.gz
.
File metadata
- Download URL: flask-lambda-0.0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d085da453c2caa9284aea0e74622cff49b7fa7fda9b4534dec1a9befe856a5b |
|
MD5 | d0dee2749790c5e68046aeae5206a50a |
|
BLAKE2b-256 | e68db0380f9c13fc4c13e8d8c6278f75a8f2f95fbaf11509fed9fd701adb58a8 |
Provenance
File details
Details for the file flask_lambda-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: flask_lambda-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd352a07152b462d77427055aeb139e9d7fb86d2be1f6f24f531f447f77f71d2 |
|
MD5 | e837a8fbe8bd9a68928691ff5d6556d6 |
|
BLAKE2b-256 | 7f7f1859f55e1256c44c66311c900c8cb74b8fb34f295a2cfd07335bc3129516 |