Skip to main content

Class Interface for AWS Lambda event.

Project description

https://github.com/MacHu-GWU/aws_lambda_event-project/workflows/CI/badge.svg https://codecov.io/gh/MacHu-GWU/aws_lambda_event-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/aws_lambda_event.svg https://img.shields.io/pypi/l/aws_lambda_event.svg https://img.shields.io/pypi/pyversions/aws_lambda_event.svg https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to aws_lambda_event Documentation

This library provides Python Class interface, attribute auto-complete, type hint for AWS Lambda Events. It can parse the AWS Lambda event data, and also generate fake event data for testing.

Example:

# An example lambda handler python module
import aws_lambda_event

# parse S3 Put event, convert it into a python object with type hint, auto complete
def handler(event, context):
    event_obj = aws_lambda_event.S3PutEvent.from_dict(event)

    for record in event_obj.Records:
        # access attribute
        _ = record.eventTime

        # important attributes quick access alias
        _ = record.bucket
        _ = record.key
        _ = record.etag
        _ = record.size
        ...

# generate an fake event for testing
event_obj = aws_lambda_event.S3PutEvent.fake(bucket="my-bucket", key="my-file.txt")
...

List of Supported Event:

  • CloudWatchLogsEvent

  • CloudWatchScheduledEvent

  • S3PutEvent

  • S3DeleteEvent

  • SNSTopicNotificationEvent

  • SQSEvent

  • DynamodbUpdateEvent

  • KinesisStreamEvent

  • KinesisFirehoseEvent

You can find the event JSON schema in two place:

  1. AWS Lambda Event Source Mapping Official Document: https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html

  2. Goto AWS Lambda Function Console -> Create Test Event -> Choose from Event template

Install

aws_lambda_event is released on PyPI, so all you need is:

$ pip install aws_lambda_event

To upgrade to latest version:

$ pip install --upgrade aws_lambda_event

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

aws_lambda_event-2.0.2.tar.gz (24.8 kB view hashes)

Uploaded Source

Built Distribution

aws_lambda_event-2.0.2-py2.py3-none-any.whl (36.2 kB view hashes)

Uploaded Python 2 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