Skip to main content

Gamgee helps you get up and running quickly with an AWS Lambda API.

Project description

gamgee

Test Package PyPI PyPI - License

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


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)

Uploaded Source

Built Distribution

gamgee-0.3.3-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

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