serverless-flask
pip package for flask framework with serverless framework
Compatibility
This is tested with Python3.6 and Flask 0.11.2, 1.0.0, 1.0.2
Installation
Command to install
pip install serverless-flask
Usage
Define logger and middleware annotation like below,
you can throw application log (Now logging level is only DEBUG) and add your custom middleware you define.
※ ) There is one thing to note. The order you annote should be app.route, logger and middleware from the top. If you change this order flask throw Exception. (in the future we wanna modify this restriction)
from serverless_flask.interceptor import Interceptor as interceptor
@app.route('/v.1.0/hoge', methods=['POST'])
@interceptor.logger
@interceptor.middleware(func1)
@interceptor.middleware(func2)
def test(*args, **kwargs):
return jsonify({
"message": "ok"
})
As you can see in the below code, your custom middleware should have request parameter (but you don't have to use it.).
These functions must return the values with type of dict, list or tuple, otherwise Exception will be thrown.
from flask import request
def func1(req: request):
return {'key': "value"}
def func2(req: request):
return ['val1', 'val2']
Links
Website: coming soon
Code: https://github.com/Queue-inc/serverless-flask
Company Page: http://www.queue-inc.com
Metadata
Release files for serverless-flask 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serverless_flask-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for serverless_flask-0.0.8-py3-none-any.whl |
Release files / serverless_flask-0.0.8-py3-none-any.whl
| Download URL | serverless_flask-0.0.8-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e214c7778acba17c3046017de6742ae6bf8311106dd761891b51e986c5d9fa0
|
|
BLAKE2b-256 checksum How to use checksums |
0993af94f2e2e51bb97c926e70653a464ef97a304d5f16e1bb924123ed943e9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.0
|
Security for serverless-flask 0.0.8
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.