Skip to main content

Lightweight webhook monitoring SDK for Python

Project description

Outworx Hooks Python SDK

Lightweight webhook monitoring SDK for Python. Know exactly when your webhooks break, how long they take, and what payload they received.

Features

  • 🚀 Zero Latency: Events are batched and sent in a background thread.
  • 🛠️ Framework Support: Native integrations for FastAPI, Flask, and Django.
  • 🔐 Privacy First: Sensitive headers are automatically redacted.
  • 📦 Lightweight: Minimal dependencies, focus on performance.

Installation

pip install outworx-hooks

Quick Start

1. Initialize the SDK

import outworx_hooks

outworx_hooks.init(api_key="your_api_key_here")

2. Framework Integrations

FastAPI

from fastapi import FastAPI
from outworx_hooks.integrations.fastapi import OutworxHooksMiddleware
from outworx_hooks import TrackOptions

app = FastAPI()

app.add_middleware(
    OutworxHooksMiddleware,
    options=TrackOptions(provider="stripe")
)

@app.post("/webhook")
async def handle_webhook():
    return {"status": "ok"}

Flask

from flask import Flask
from outworx_hooks.integrations.flask import with_webhook_monitoring
from outworx_hooks import TrackOptions

app = Flask(__name__)

@app.route("/webhook", methods=["POST"])
@with_webhook_monitoring(TrackOptions(provider="stripe"))
def handle_webhook():
    return {"status": "ok"}

Django

Add the middleware to your MIDDLEWARE setting:

# settings.py
MIDDLEWARE = [
    ...
    'outworx_hooks.integrations.django.OutworxHooksMiddleware',
]

OUTWORX_HOOKS_OPTIONS = {
    'provider': 'stripe',
    'capture_body': True
}

Advanced Configuration

You can pass various options to TrackOptions:

Option Type Description
provider str Name of the webhook provider (e.g., "stripe", "shopify").
event_type_header str Header name to extract the event type from.
event_type_field str JSON field name to extract the event type from.
capture_body bool Whether to capture the response body (default: False).
capture_headers bool Whether to capture request headers (default: True).
metadata dict Custom metadata to attach to the event.

License

MIT

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

outworx_hooks-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

outworx_hooks-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file outworx_hooks-0.1.0.tar.gz.

File metadata

  • Download URL: outworx_hooks-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for outworx_hooks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fff0e49233a378bc4028b33f6fa7e1b84063d072240bdf4f05e40e6ca0990d6f
MD5 fadb92e8afed9040fc13b7a6664e920c
BLAKE2b-256 272a686ec3dfa886516a430a945286c905b05d7f30c9fb34f96cb0146365e9a9

See more details on using hashes here.

File details

Details for the file outworx_hooks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: outworx_hooks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for outworx_hooks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b1da460e1e1a4979019850d57f62c4eb0992e0bebdec717e3a4711b15eea04fe
MD5 36aba5cae9f65ac209dde78886edda3f
BLAKE2b-256 52fbe4d87c9e1c8ae72f4fdc0284d2e9bacd20b0832a0d9f7d588951ba5635ec

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