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                                                           

In [2]: event = {"queryStringParameters": {"name": "samwise"}}                  

In [3]: @gamgee.sam() 
   ...: def lambda_handler(name: gamgee.Query(str)) -> int: 
   ...:     return len(name) 
   ...:                                                                         

In [4]: lambda_handler(event, None)                                             
Out[4]: {'status_code': 200, 'body': '{"success": true, "result": 7}'}

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.2.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

gamgee-0.3.2-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