HookSniff Python SDK
Python SDK for the HookSniff webhook delivery platform.
Installation
pip install hooksniff
Quick Start
from hooksniff import HookSniff
# API anahtarınızı https://hooksniff.vercel.app adresinden alın
hs = HookSniff("hooksniff_xxx")
# Endpoint'leri listele
endpoints = hs.endpoint.list()
# Yeni endpoint oluştur
endpoint = hs.endpoint.create(
EndpointIn(url="https://example.com/webhook", description="My endpoint")
)
# Webhook gönder
delivery = hs.message.create(
endpoint_id="ep_xxx",
event="order.created",
data={"order_id": "123", "amount": 99.99}
)
# Teslimat denemelerini gör
attempts = hs.message_attempt.list_by_delivery(delivery.id)
Authentication
from hooksniff.api.authentication import Authentication
auth = hs.authentication
# Giriş yap
result = auth.login("user@example.com", "password123")
token = result["token"]
# Kayıt ol
result = auth.register("user@example.com", "password123", name="Servet")
# Profilimi gör
me = auth.get_me()
# 2FA etkinleştir
qr = auth.enable_2fa("password123")
Endpoints
from hooksniff.models import EndpointIn, EndpointUpdate, EndpointPatch
# Listele
endpoints = hs.endpoint.list()
# Oluştur
ep = hs.endpoint.create(EndpointIn(
url="https://example.com/webhook",
description="Order notifications",
event_filter=["order.*"],
routing_strategy="round-robin"
))
# Güncelle
ep = hs.endpoint.update(ep.id, EndpointUpdate(
url="https://new-url.com/webhook",
description="Updated endpoint"
))
# Kısmi güncelleme
ep = hs.endpoint.patch(ep.id, EndpointPatch(description="Patched"))
# Sil
hs.endpoint.delete(ep.id)
# Secret rotate
hs.endpoint.rotate_secret(ep.id)
Webhooks
from hooksniff.models import MessageIn
# Tek webhook gönder
delivery = hs.message.create(
endpoint_id="ep_xxx",
event="order.created",
data={"order_id": "123"}
)
# Toplu gönder
result = hs.message.batch([
{"endpoint_id": "ep_xxx", "event": "order.created", "data": {"order_id": "1"}},
{"endpoint_id": "ep_xxx", "event": "order.shipped", "data": {"order_id": "2"}},
])
# Teslimat listesi
deliveries = hs.message.list()
# Tekrar gönder
hs.message.replay("del_xxx")
Other Resources
# Background tasks
tasks = hs.background_task.list()
task = hs.background_task.get("task_xxx")
# Environments
envs = hs.environment.list()
env = hs.environment.create(EnvironmentIn(name="production"))
# Connectors
connectors = hs.connector.list()
# Integrations
integrations = hs.integration.list()
# Streaming
channels = hs.stream.list_channels()
# Statistics
stats = hs.statistics.get_account_stats()
Webhook Verification
from hooksniff import Webhook
wh = Webhook("whsec_xxx")
# Gelen webhook'u doğrula
try:
payload = wh.verify(raw_body, headers)
print("Valid webhook:", payload)
except Exception:
print("Invalid signature!")
Async Support
from hooksniff import HookSniffAsync
hs = HookSniffAsync("hooksniff_xxx")
endpoints = await hs.endpoint.list()
Error Handling
from hooksniff import (
HookSniffError,
NotFoundError,
RateLimitError,
UnauthorizedError,
)
try:
hs.endpoint.get("nonexistent")
except NotFoundError:
print("Endpoint bulunamadı")
except RateLimitError as e:
print(f"Rate limit aşıldı, {e.retry_after}s bekle")
except UnauthorizedError:
print("Geçersiz API anahtarı")
except HookSniffError as e:
print(f"Hata: {e.status_code} - {e}")
Links
License
MIT
Metadata
Release files for hooksniff 1.2.2
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-1.2.2.tar.gz | 54.4 kB | Without provenance | Details for hooksniff-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hooksniff-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for hooksniff-1.2.2-py3-none-any.whl |
Total release size: 145.3 kB
Release files / hooksniff-1.2.2.tar.gz
| Download URL | hooksniff-1.2.2.tar.gz |
|---|---|
| Size | 54.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81bc5962396b42553d3827e1a3ef18bce5ad75977eff21b56da8ce8115fa5b38
|
|
BLAKE2b-256 checksum How to use checksums |
b598bd2488db5fd3cfd5e368a0f78023ef2a024e5269aba0e44a36bbc0daed3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / hooksniff-1.2.2-py3-none-any.whl
| Download URL | hooksniff-1.2.2-py3-none-any.whl |
|---|---|
| Size | 90.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7eedd66002338acbacf8072ccc6d58112b84d68c315bc41ef8b85b5a908a830f
|
|
BLAKE2b-256 checksum How to use checksums |
6917715281f32426d6ff7acb7ada98388659d0757cc3c24b8e17ec72d46a9a95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for hooksniff 1.2.2
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.