Skip to main content

fix long description

Project description


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']
```




Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

serverless_flask-0.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file serverless_flask-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: serverless_flask-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.0

File hashes

Hashes for serverless_flask-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1feb34e6fe3e6d96a600fdf500e0470fbb2e74d3a23755e99fae806babce2446
MD5 6eb48ff8963e4d3ccfd4292b64635bbe
BLAKE2b-256 2aa95f17c448abe0ab366ec7eca70bdc41f9045091acfaf1b1def819d29d3ea3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page