Skip to main content

A lightweight, resilient webhook sender and receiver.

Project description

LazyHooks

A lightweight, standalone Python package for sending and receiving webhooks with optional persistence.

Features

  • Simple API: Send webhooks with minimal boilerplate.
  • Async First: Built on asyncio and aiohttp for high performance.
  • Secure: HMAC-SHA256 signing with Timestamp Replay Protection.
  • Reliable: Optional SQLite storage to persist and retry failed webhooks.

Security

LazyHooks prioritizes security by design:

  • Replay Protection: All webhooks include a timestamp. Requests older than 5 minutes are rejected.
  • HMAC-SHA256: Signatures verify both the body and the timestamp (timestamp.body) to prevent tampering.
  • Constant-Time Verification: Prevents timing attacks.
  • SQL Injection Safe: Parameterized queries.

headers:

  • X-Lh-Timestamp: Unix timestamp of the request.
  • X-Lh-Signature: v1=... (HMAC of timestamp.body)

Documentation

🔰 Beginner Tutorials (Start Here!)

  1. What are Webhooks?: The basics explained simply.
  2. Installation: Quick setup guide.
  3. Your First Webhook: Send "Hello World" in 2 minutes.
  4. Receiving Webhooks: Listen for events securely.
  5. Testing with Tunnels: Go live with ngrok.

📚 Core Documentation

Quick Example

Sending

import asyncio
from lazyhooks import WebhookSender

async def main():
    sender = WebhookSender(signing_secret="super-secret")
    await sender.send("https://example.com/webhook", {"event": "hello"})

asyncio.run(main())

Receiving

from lazyhooks import verify_signature

def handle_webhook(request):
    timestamp = request.headers.get("X-Lh-Timestamp")
    signature = request.headers.get("X-Lh-Signature")
    body = request.body
    
    if verify_signature(body, signature, "super-secret", timestamp):
        return "OK", 200
    else:
        return "Invalid Signature or Timestamp", 401

Links

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

lazyhooks-0.2.1.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

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

lazyhooks-0.2.1-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file lazyhooks-0.2.1.tar.gz.

File metadata

  • Download URL: lazyhooks-0.2.1.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lazyhooks-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8dd4613839b5ae00773b1ff40caaef2a9240c64d6dc34e5fc3e4a0e259f56b08
MD5 27761ffaa390b453b52f7c7d8eb3e986
BLAKE2b-256 6bbe9ace57977c5e6f64d303f5ca211e6159330fd541ecd7258dd54b9c8af98c

See more details on using hashes here.

File details

Details for the file lazyhooks-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: lazyhooks-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lazyhooks-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c546191dd4bd4dedb269aa7f0cd78fb01633656e521489ec5c67f613667f8f
MD5 cd0b7e15ddfea2587740090de522fe16
BLAKE2b-256 1e3d681d49b6955227cb48dbf6109269f49c40fd006791a3453c426f0257d6da

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