HookSniff Python SDK
Official Python SDK for HookSniff — the webhook infrastructure for developers.
Installation
pip install hooksniff-python
Quick Start
from hooksniff import HookSniff
hs = HookSniff("hr_live_...")
# Create an application
app = hs.application.create(name="My App")
# Create an endpoint
ep = hs.endpoint.create(
url="https://app.com/webhook",
application_id=app["id"],
description="Order notifications",
)
# Send a webhook
delivery = hs.webhook.send(
endpoint_id=ep["id"],
event="order.created",
data={"order_id": "12345", "amount": 99.99},
)
print(delivery["id"]) # "msg_..."
Features
- Simple API — 2 lines to send a webhook
- Auto-pagination — Iterate through all resources automatically
- Auto-retry — Exponential backoff on 429/5xx errors
- Idempotency — Built-in idempotency key support
- Webhook verification — Verify incoming webhooks (Standard Webhooks compliant)
- Error handling — Typed exceptions
- 27+ Resources — Application, Endpoint, Webhook, Billing, Cortex, Teams, and more
Usage
Applications
# Create
app = hs.application.create(name="My App", description="My application")
# List with auto-pagination
for app in hs.application.list():
print(app["name"])
# Get
app = hs.application.get("app_123")
# Update
app = hs.application.update("app_123", name="New Name")
# Delete
hs.application.delete("app_123")
Endpoints
# Create
ep = hs.endpoint.create(
url="https://app.com/webhook",
application_id="app_123",
description="Order notifications",
)
# List with auto-pagination
for ep in hs.endpoint.list():
print(ep["url"])
# Get
ep = hs.endpoint.get("ep_123")
# Update
ep = hs.endpoint.update("ep_123", url="https://new-url.com/webhook")
# Delete
hs.endpoint.delete("ep_123")
# Rotate signing secret
secret = hs.endpoint.rotate_secret("ep_123")
print(secret["signing_secret"]) # "whsec_..."
Webhooks
# Send a webhook
delivery = hs.webhook.send(
endpoint_id="ep_123",
event="order.created",
data={"order_id": "12345", "amount": 99.99},
)
# Send with idempotency key
delivery = hs.webhook.send(
endpoint_id="ep_123",
event="order.created",
data={},
idempotency_key="unique-key-123",
)
# Send batch
result = hs.webhook.send_batch([
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "1"}},
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "2"}},
])
# List deliveries with auto-pagination
for d in hs.webhook.list(per_page=10):
print(d["status"])
# Get delivery
delivery = hs.webhook.get("msg_123")
# Replay delivery
delivery = hs.webhook.replay("msg_123")
Webhook Verification
from hooksniff import Webhook, WebhookVerificationError
wh = Webhook("whsec_...")
# In your Flask/FastAPI handler:
def handle_webhook(request):
try:
event = wh.verify(request.body, request.headers)
print(event)
return "OK", 200
except WebhookVerificationError:
return "Invalid signature", 401
Error Handling
from hooksniff import AuthenticationError, NotFoundError, RateLimitError
try:
hs.endpoint.get("invalid_id")
except NotFoundError:
print("Endpoint not found")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
All Resources
# API Keys
hs.api_key.list()
hs.api_key.create(name="Production Key")
hs.api_key.delete("key_123")
# Analytics
hs.analytics.deliveries(range="24h")
hs.analytics.success_rate(range="7d")
# Billing
hs.billing.subscription()
hs.billing.upgrade(plan="pro")
hs.billing.portal()
# Teams
hs.team.list()
hs.team.create(name="Engineering")
# Cortex AI
hs.cortex.insights()
hs.cortex.anomalies(endpoint_id="ep_123")
hs.cortex.predict("ep_123")
hs.cortex.auto_heal("ep_123")
# Notifications
hs.notification.list()
hs.notification.get_unread_count()
hs.notification.mark_read("notif_123")
hs.notification.mark_all_read()
# Templates
hs.template.list()
hs.template.get("tmpl_123")
# Schemas
hs.schema.list()
hs.schema.create(name="Order Schema", schema={...})
hs.schema.validate("schema_123", {"order_id": "123"})
# Alerts
hs.alert.list()
hs.alert.create(name="...", condition="failure_rate", threshold=10, channels=["email"])
# Connectors
hs.connector.list()
hs.connector.list_configs()
# Stream
hs.stream.list_channels()
hs.stream.publish(channel_id="ch_123", event="test", data={...})
# Background Tasks
hs.background_task.list()
hs.background_task.get("task_123")
# Integrations
hs.integration.list()
# Service Tokens
hs.service_token.list()
# Operational Webhooks
hs.operational_webhook.list()
# Search
hs.search.deliveries("order.created")
# Health
hs.health.check()
hs.health.outbound_ips()
# User
hs.me()
Configuration
hs = HookSniff(
"hr_live_...",
base_url="https://your-instance.com", # Custom API URL
timeout=30, # Request timeout (seconds)
retries=3, # Max retries on 5xx/429
headers={"X-Custom": "value"}, # Custom headers
)
Requirements
- Python 3.8+
License
MIT — see LICENSE for details.
Metadata
Release files for hooksniff-python 0.4.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hooksniff_python-0.4.4.tar.gz | 13.4 kB | Without provenance | Details for hooksniff_python-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hooksniff_python-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for hooksniff_python-0.4.4-py3-none-any.whl |
Total release size: 34.7 kB
Release files / hooksniff_python-0.4.4.tar.gz
| Download URL | hooksniff_python-0.4.4.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c14c6e9479e899d3f9484bd2c3ddb6c5eaa6e2b5f16d752e5b5f7f036d8da52c
|
|
BLAKE2b-256 checksum How to use checksums |
f0944adf2be83eb6e3fda2f54c00848d800ac8fc0442d8ccd80ab66854b55a35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / hooksniff_python-0.4.4-py3-none-any.whl
| Download URL | hooksniff_python-0.4.4-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
508ac53c7bd9b5bd071a925acc01039f4feab7e2bd8eaa052793079d2ece7014
|
|
BLAKE2b-256 checksum How to use checksums |
e180188d8ae395e6279dfe96d5048ae439bb7a03d7c5dc77c5272a04ac22b2c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for hooksniff-python 0.4.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.