serverless sdk library for python code example

Example 1: creating rest api in serverless with python

1# serverless.yml
2
3service: serverless-flask
4
5plugins:
6  - serverless-python-requirements
7  - serverless-wsgi
8
9custom:
10  wsgi:
11    app: app.app
12    packRequirements: false
13  pythonRequirements:
14    dockerizePip: non-linux
15
16provider:
17  name: aws
18  runtime: python3.6
19  stage: dev
20  region: us-east-1
21
22functions:
23  app:
24    handler: wsgi.handler
25    events:
26      - http: ANY /
27      - http: 'ANY {proxy+}'

Example 2: creating rest api in serverless with python

1$ virtualenv venv --python=python3
2$ source venv/bin/activate