flask-lambda
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)
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 python-mu.
Metadata
Release files for flask-lambda 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flask-lambda-0.0.4.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_lambda-0.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 9.0 kB
Release files / flask-lambda-0.0.4.tar.gz
| Download URL | flask-lambda-0.0.4.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
489fa54dc97b7fb7ddeaacd137544ad32c1a3399a5870046b31bef2e909d9fea
|
|
BLAKE2b-256 checksum How to use checksums |
f0c509d755afa39a52f98b9edf057e56963fd72810455e04e4e93bb6f21108f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / flask_lambda-0.0.4-py2.py3-none-any.whl
| Download URL | flask_lambda-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b2859140b936ac7380d29901d338adf0e5ce19a504aa12659e54f58c94774fc1
|
|
BLAKE2b-256 checksum How to use checksums |
e99c4ab71d90f9ed12794b4f2d04960a7bf7b199c389cfee832168036fa72402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |