Serverless nanoframework for AWS API Gateway and AWS Lambda
Project description
Sippy Cup is an extremely minimalistic Python framework to quickly create serverless applications using AWS API Gateway and AWS Lambda.
Sippy Cup converts the input format sent to an AWS Lambda function by API Gateway into a WSGI environment to provide a set of Werkzeug-based request and response objects, converting the latter to the return format expected by API Gateway.
It is intended to be similar in use to Python frameworks such as Flask and Chalice, although it has a significantly smaller feature set by design.
Background
https://ben.fogbutter.com/2016/11/09/introducing-sippy-cup.html
Getting started
Installation
Because you will eventually need to create a deployment package, it is highly recommended that you use a virtualenv when using Sippy Cup.
pip install sippycup
Create a simple application
lambda_function.py provides a demo application
# lambda_function.py
from sippycup import SippyCup
app = SippyCup()
@app.route('/hello/<string:name>', methods=['GET', 'POST'])
@app.mimetype('text/plain')
def hello_world(name='World'):
return 'Hello, {0}!'.format(name)
@app.route('/')
def index():
# return the original event sent to Lambda from API Gateway
return app.request.apigr
lambda_handler = app.run
if __name__ == '__main__':
from werkzeug.serving import run_simple
run_simple(
'127.0.0.1', 5000, lambda_handler, use_debugger=True, use_reloader=True
)
You will need to create a deployment package and use that to create a new AWS Lambda function.
Finally, set up an API Gateway proxy resource with the lambda proxy integration. It is recommended to create resources on both ‘/’ and ‘/SOMEPREFIX’ unless you don’t need the ‘/’ route.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file sippycup-0.3.0.tar.gz
.
File metadata
- Download URL: sippycup-0.3.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07095b402bc5e1441029aebd4cf274e41ebbfcc72e661d59aba52078aea3d973 |
|
MD5 | f54912ba2553de40ae13a6eaf124c2a6 |
|
BLAKE2b-256 | a10b88b59730cb9a1dc556ae93ab266c9ab7f156db2ed3eaf6582f963ad8288e |