HookSentry CLI
#python#automation#microsaas
Sostituisci i costosi SaaS per webhook. HookSentry CLI è un proxy self-hosted pronto per la produzione e un motore di auto-retry in Go. Acquisisci payload con verifica HMAC, archiviazione DLQ integrata, retry con backoff esponenziale, alert istantanei sugli incidenti e una dashboard di replay con 1-click. Include binari multi-arch e configurazioni Docker Compose.
Leggi l'approfondimento tecnicoAddio Proxy Webhook SaaS: Self-Hosting con HookSentry CLI per Ingestion Infallibilimain.pymain.py — estratto d'esempio nello stile del tool
#!/usr/bin/env python3
"""
HookSentry CLI
Production-ready, self-hosted webhook proxy and auto-retry engine. Ingests incoming
payloads with HMAC signature verification, stores failures in an embedded DLQ, and
executes exponential backoff retries with instant incident alerts.
Features:
- Multi-provider HMAC signature verification (GitHub, Stripe, Shopify, custom)
- SQLite-backed Dead Letter Queue (DLQ) for durable payload storage
- Exponential backoff retry engine with customizable max attempts
- Real-time incident notification dispatcher via webhooks/Slack
- Built-in CLI dashboard for inspecting and replaying failed events
Usage:
$ hooksentry serve --port 8080 --db-path ./dlq.db
$ hooksentry replay --event-id evt_12345 --target http://localhost:5000/webhook
"""
from dataclasses import dataclass, field
import enum
import hashlib
import hmac
import logging
import sqlite3
import time
from typing import Dict, Optional
class DeliveryStatus(str, enum.Enum):
"""Webhook delivery status lifecycle states."""
PENDING = "PENDING"
PROCESSING = "PROCESSING"
SUCCESS = "SUCCESS"
FAILED = "FAILED"
DLQ = "DLQ"
@dataclass
class WebhookEvent:
"""Domain representation of an ingested webhook payload."""
event_id: str
provider: str
payload: bytes
headers: Dict[str, str]
status: DeliveryStatus = DeliveryStatus.PENDING
attempts: int = 0
class HookSentryEngine:
"""Core orchestration engine for payload ingestion and retries."""
# ... the full file ships with your download