Skip to main content

A small example package

Project description

gamgee

Test Package PyPI PyPI - License

created by Austin Poor

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

  • Test gamgee.sam decorator
  • Add a logger function / submodule

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

Uploaded Source

Built Distribution

gamgee-0.2.1-py3-none-any.whl (8.1 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