Gamgee helps you get up and running quickly with an AWS Lambda API.
Project description
gamgee
A python library for helping to setup an AWS SAM app -- specifically API Gateway SAM apps. gamgee
aims to help users avoid rewriting boilerplate code within AWS Lambda handler functions.
The core functionality is wrapped up in the decorator function @gamgee.sam
-- which can help with:
- Converting API request
event
dictionaries to function params (gathered from path-params, the query string, and the request body) - Handling errors and responses by catching them and returning them with the propper HTTP status codes
- Authenticating / authorizing users making requests
Quick Start
In [1]: import gamgee, json
In [2]: event = {"body": "{\"hello\":\"world\"}", "queryStringParameters": {"name": "samwise"}}
In [3]: @gamgee.sam(body=json.loads, queryString=True)
...: def lambda_handler(body, query):
...: return body["hello"]
...:
In [4]: lambda_handler(event, None)
Out[4]: {'statusCode': 200, 'body': '{"success": true, "result": "world"}'}
Installation
$ pip install gamgee
To-Do
- Handle function request type parsing like FastAPI
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
gamgee-0.3.3.tar.gz
(6.7 kB
view hashes)
Built Distribution
gamgee-0.3.3-py3-none-any.whl
(7.8 kB
view hashes)