Flask-Lambda2
Flask-Lambda2 is a python package to add a compatibility layer between a Flask application and AWS Lambda for creating RESTful applications.
This package is opinionated, in that “it locks or guides you into [our] way of doing things” or “doesn’t make it easy to diverse from [our] golden path.”
Installation
$ pip install flask-lambda2
Requirements
The main assumption here is that your project can comfortably and reasonably fit into a single endpoint, or you separate your Lambda functions to group certain, related API endpoints together.
Firstly, ensure your Lambda handler is set to project_api.app, where project_api is the filename (excluding the .py extension) containing your project’s API endpoint implementations and where app is the Flask instance (actually a FlaskLambda instance) with which you have added the URL rules onto.
Lastly, ensure that invokation convention from the location you plan to invoke the endpoints from roughly follows the calling convention shown below:
import boto3
client = boto3.client('lambda')
client.invoke(FunctionName='project_api',
InvocationType='RequestResponse',
Payload=json.dumps({'route':'/users/',
'method':'get',
'token':'123abc'}))
That’s it!
Tests
Tests are available in Flask-Lambda2/tests through invoking test.py with python test.py. Ensure all dependencies are installed through invoking pip install -r requirements.txt.
Functional Examples
GridLight-API
I have created a backend for a mobile application using this library, it’s source code is available here at the GridLight-API repository.
If you have any questions, feel free to e-mail me at pianka@eml.cc.
Built With
Flask - Micro web-framework based on Werkzeug and Jinja2
License
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details
Metadata
Release files for flask-lambda2 2.0.0
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 | Actions |
|---|---|---|---|---|
| flask-lambda2-2.0.0.tar.gz | 3.6 kB | Without provenance | Details for flask-lambda2-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_lambda2-2.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for flask_lambda2-2.0.0-py2.py3-none-any.whl |
Total release size: 9.0 kB
Release files / flask-lambda2-2.0.0.tar.gz
| Download URL | flask-lambda2-2.0.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
887e7cbc11504511d87288bdef0dcbfa5c39aed187edbbe321d189f8e2cb1b98
|
|
BLAKE2b-256 checksum How to use checksums |
b3a73f97356b529f39fb07db863fdc646b543f9e38e9fe87024ae6beca5d5cec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / flask_lambda2-2.0.0-py2.py3-none-any.whl
| Download URL | flask_lambda2-2.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8ac78409668d8be9c1b31383baa110d9709febe63274d2c0c7eb330426e41f58
|
|
BLAKE2b-256 checksum How to use checksums |
3649f67b0970590a8b136b206643240406bd438639da1ca41109b0038d40ed9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for flask-lambda2 2.0.0
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.