Skip to main content

A flexible AWS Lambda event router with support for multiple event sources

Project description

Lambda Universal Router

PyPI version Python Support License Documentation

A flexible and type-safe router for AWS Lambda functions that supports multiple event sources. This library makes it easy to handle different types of AWS Lambda events in a clean and organized way.

Documentation

📚 Full Documentation

Features

  • 🎯 Type-safe event handling with proper Python type hints
  • 🔄 Support for multiple AWS event sources
  • 🎨 Clean decorator-based routing
  • 📦 Easy to extend with new event sources
  • 🔒 Structured event objects with proper typing
  • 🔍 Custom event handler support for unknown event types

Installation

pip install lambda-universal-router

Quick Start

from lambda_universal_router import Router
from lambda_universal_router.events import APIGatewayEvent, SQSEvent, CustomEvent

router = Router()

@router.apigateway("/hello", method="GET")
def hello(event: APIGatewayEvent, context):
    name = event.query_string_parameters.get('name', 'World')
    return {
        "statusCode": 200,
        "body": f"Hello, {name}!"
    }

@router.sqs()
def process_queue(event: SQSEvent, context):
    for msg in event.records:
        print(f"Processing message {msg.message_id}: {msg.body}")

@router.custom()
def handle_unknown(event: CustomEvent, context):
    print(f"Handling unknown event type: {event.event_data}")

def lambda_handler(event, context):
    return router.dispatch(event, context)

Supported Event Sources

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

See our Contributing Guide for more details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for a list of changes and version history.

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

lambda_universal_router-0.2.3.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lambda_universal_router-0.2.3-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file lambda_universal_router-0.2.3.tar.gz.

File metadata

  • Download URL: lambda_universal_router-0.2.3.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for lambda_universal_router-0.2.3.tar.gz
Algorithm Hash digest
SHA256 bc0afd2662c00204224ac68ab65b4e045443db1e9cf24050759528b9d4eff73e
MD5 3e227f2960c0a00ad8544dc6a4fe7802
BLAKE2b-256 9378c64bb092d1ee8207606aee47be1130a5e549fe03b730ef7a6be65f3fcab7

See more details on using hashes here.

File details

Details for the file lambda_universal_router-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lambda_universal_router-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1cec1d6d07f5f3902968fff8e90ec963d4bc47949374fc6ff2da602a39e42b99
MD5 60679009ae0fc77d49826b2f6244e150
BLAKE2b-256 1e389bc16c15561e7df29aba5b2f5dbde5c1f67a5b55aaa48873bc5f4f05d315

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page