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
asyncioandaiohttpfor high performance. - Secure: HMAC-SHA256 signing with Timestamp Replay Protection.
- Reliable: Optional
SQLitestorage 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 oftimestamp.body)
Documentation
🔰 Beginner Tutorials (Start Here!)
- What are Webhooks?: The basics explained simply.
- Installation: Quick setup guide.
- Your First Webhook: Send "Hello World" in 2 minutes.
- Receiving Webhooks: Listen for events securely.
- Testing with Tunnels: Go live with ngrok.
📚 Core Documentation
- Getting Started: Installation and quick examples.
- Sending Webhooks: Sending usage.
- Receiving Webhooks: Receiver usage.
- Storage & Retries: Persistence and reliability.
- Security: Security details.
- Comparisons: Alternatives analysis.
- API Reference: API docs.
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
- PyPI: https://pypi.org/project/lazyhooks
- Issues: https://github.com/StackTactician/LazyHooks/issues
- Documentation: See the GitHub repo for full docs, advanced usage, and examples.
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
lazyhooks-0.2.1-py3-none-any.whl
(22.5 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dd4613839b5ae00773b1ff40caaef2a9240c64d6dc34e5fc3e4a0e259f56b08
|
|
| MD5 |
27761ffaa390b453b52f7c7d8eb3e986
|
|
| BLAKE2b-256 |
6bbe9ace57977c5e6f64d303f5ca211e6159330fd541ecd7258dd54b9c8af98c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5c546191dd4bd4dedb269aa7f0cd78fb01633656e521489ec5c67f613667f8f
|
|
| MD5 |
cd0b7e15ddfea2587740090de522fe16
|
|
| BLAKE2b-256 |
1e3d681d49b6955227cb48dbf6109269f49c40fd006791a3453c426f0257d6da
|