hooksniff-python 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hooksniff_python-0.4.1/.gitignore +6 -0
- hooksniff_python-0.4.1/LICENSE +21 -0
- hooksniff_python-0.4.1/PKG-INFO +284 -0
- hooksniff_python-0.4.1/README.md +261 -0
- hooksniff_python-0.4.1/hooksniff/__init__.py +41 -0
- hooksniff_python-0.4.1/hooksniff/client.py +108 -0
- hooksniff_python-0.4.1/hooksniff/exceptions.py +50 -0
- hooksniff_python-0.4.1/hooksniff/http_client.py +138 -0
- hooksniff_python-0.4.1/hooksniff/resources.py +410 -0
- hooksniff_python-0.4.1/hooksniff/webhook.py +85 -0
- hooksniff_python-0.4.1/pyproject.toml +32 -0
- hooksniff_python-0.4.1/test_live.py +352 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HookSniff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hooksniff-python
|
|
3
|
+
Version: 0.4.1
|
|
4
|
+
Summary: Official HookSniff SDK for Python - Webhook infrastructure for developers
|
|
5
|
+
Project-URL: Homepage, https://hooksniff.vercel.app
|
|
6
|
+
Project-URL: Repository, https://github.com/servetarslan02/hooksniff-python
|
|
7
|
+
Author-email: HookSniff <support@hooksniff.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: api,hooksniff,sdk,webhook,webhooks
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# HookSniff Python SDK
|
|
25
|
+
|
|
26
|
+
Official Python SDK for [HookSniff](https://hooksniff.vercel.app) — the webhook infrastructure for developers.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install hooksniff
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from hooksniff import HookSniff
|
|
38
|
+
|
|
39
|
+
hs = HookSniff("hr_live_...")
|
|
40
|
+
|
|
41
|
+
# Create an application
|
|
42
|
+
app = hs.application.create(name="My App")
|
|
43
|
+
|
|
44
|
+
# Create an endpoint
|
|
45
|
+
ep = hs.endpoint.create(
|
|
46
|
+
url="https://app.com/webhook",
|
|
47
|
+
application_id=app["id"],
|
|
48
|
+
description="Order notifications",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Send a webhook
|
|
52
|
+
delivery = hs.webhook.send(
|
|
53
|
+
endpoint_id=ep["id"],
|
|
54
|
+
event="order.created",
|
|
55
|
+
data={"order_id": "12345", "amount": 99.99},
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
print(delivery["id"]) # "msg_..."
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- **Simple API** — 2 lines to send a webhook
|
|
64
|
+
- **Auto-pagination** — Iterate through all resources automatically
|
|
65
|
+
- **Auto-retry** — Exponential backoff on 429/5xx errors
|
|
66
|
+
- **Idempotency** — Built-in idempotency key support
|
|
67
|
+
- **Webhook verification** — Verify incoming webhooks (Standard Webhooks compliant)
|
|
68
|
+
- **Error handling** — Typed exceptions
|
|
69
|
+
- **27+ Resources** — Application, Endpoint, Webhook, Billing, Cortex, Teams, and more
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
### Applications
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
# Create
|
|
77
|
+
app = hs.application.create(name="My App", description="My application")
|
|
78
|
+
|
|
79
|
+
# List with auto-pagination
|
|
80
|
+
for app in hs.application.list():
|
|
81
|
+
print(app["name"])
|
|
82
|
+
|
|
83
|
+
# Get
|
|
84
|
+
app = hs.application.get("app_123")
|
|
85
|
+
|
|
86
|
+
# Update
|
|
87
|
+
app = hs.application.update("app_123", name="New Name")
|
|
88
|
+
|
|
89
|
+
# Delete
|
|
90
|
+
hs.application.delete("app_123")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Endpoints
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
# Create
|
|
97
|
+
ep = hs.endpoint.create(
|
|
98
|
+
url="https://app.com/webhook",
|
|
99
|
+
application_id="app_123",
|
|
100
|
+
description="Order notifications",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# List with auto-pagination
|
|
104
|
+
for ep in hs.endpoint.list():
|
|
105
|
+
print(ep["url"])
|
|
106
|
+
|
|
107
|
+
# Get
|
|
108
|
+
ep = hs.endpoint.get("ep_123")
|
|
109
|
+
|
|
110
|
+
# Update
|
|
111
|
+
ep = hs.endpoint.update("ep_123", url="https://new-url.com/webhook")
|
|
112
|
+
|
|
113
|
+
# Delete
|
|
114
|
+
hs.endpoint.delete("ep_123")
|
|
115
|
+
|
|
116
|
+
# Rotate signing secret
|
|
117
|
+
secret = hs.endpoint.rotate_secret("ep_123")
|
|
118
|
+
print(secret["signing_secret"]) # "whsec_..."
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Webhooks
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
# Send a webhook
|
|
125
|
+
delivery = hs.webhook.send(
|
|
126
|
+
endpoint_id="ep_123",
|
|
127
|
+
event="order.created",
|
|
128
|
+
data={"order_id": "12345", "amount": 99.99},
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# Send with idempotency key
|
|
132
|
+
delivery = hs.webhook.send(
|
|
133
|
+
endpoint_id="ep_123",
|
|
134
|
+
event="order.created",
|
|
135
|
+
data={},
|
|
136
|
+
idempotency_key="unique-key-123",
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Send batch
|
|
140
|
+
result = hs.webhook.send_batch([
|
|
141
|
+
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "1"}},
|
|
142
|
+
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "2"}},
|
|
143
|
+
])
|
|
144
|
+
|
|
145
|
+
# List deliveries with auto-pagination
|
|
146
|
+
for d in hs.webhook.list(per_page=10):
|
|
147
|
+
print(d["status"])
|
|
148
|
+
|
|
149
|
+
# Get delivery
|
|
150
|
+
delivery = hs.webhook.get("msg_123")
|
|
151
|
+
|
|
152
|
+
# Replay delivery
|
|
153
|
+
delivery = hs.webhook.replay("msg_123")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Webhook Verification
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from hooksniff import Webhook, WebhookVerificationError
|
|
160
|
+
|
|
161
|
+
wh = Webhook("whsec_...")
|
|
162
|
+
|
|
163
|
+
# In your Flask/FastAPI handler:
|
|
164
|
+
def handle_webhook(request):
|
|
165
|
+
try:
|
|
166
|
+
event = wh.verify(request.body, request.headers)
|
|
167
|
+
print(event)
|
|
168
|
+
return "OK", 200
|
|
169
|
+
except WebhookVerificationError:
|
|
170
|
+
return "Invalid signature", 401
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Error Handling
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
from hooksniff import AuthenticationError, NotFoundError, RateLimitError
|
|
177
|
+
|
|
178
|
+
try:
|
|
179
|
+
hs.endpoint.get("invalid_id")
|
|
180
|
+
except NotFoundError:
|
|
181
|
+
print("Endpoint not found")
|
|
182
|
+
except AuthenticationError:
|
|
183
|
+
print("Invalid API key")
|
|
184
|
+
except RateLimitError as e:
|
|
185
|
+
print(f"Rate limited, retry after {e.retry_after}s")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### All Resources
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
# API Keys
|
|
192
|
+
hs.api_key.list()
|
|
193
|
+
hs.api_key.create(name="Production Key")
|
|
194
|
+
hs.api_key.delete("key_123")
|
|
195
|
+
|
|
196
|
+
# Analytics
|
|
197
|
+
hs.analytics.deliveries(range="24h")
|
|
198
|
+
hs.analytics.success_rate(range="7d")
|
|
199
|
+
|
|
200
|
+
# Billing
|
|
201
|
+
hs.billing.subscription()
|
|
202
|
+
hs.billing.upgrade(plan="pro")
|
|
203
|
+
hs.billing.portal()
|
|
204
|
+
|
|
205
|
+
# Teams
|
|
206
|
+
hs.team.list()
|
|
207
|
+
hs.team.create(name="Engineering")
|
|
208
|
+
|
|
209
|
+
# Cortex AI
|
|
210
|
+
hs.cortex.insights()
|
|
211
|
+
hs.cortex.anomalies(endpoint_id="ep_123")
|
|
212
|
+
hs.cortex.predict("ep_123")
|
|
213
|
+
hs.cortex.auto_heal("ep_123")
|
|
214
|
+
|
|
215
|
+
# Notifications
|
|
216
|
+
hs.notification.list()
|
|
217
|
+
hs.notification.get_unread_count()
|
|
218
|
+
hs.notification.mark_read("notif_123")
|
|
219
|
+
hs.notification.mark_all_read()
|
|
220
|
+
|
|
221
|
+
# Templates
|
|
222
|
+
hs.template.list()
|
|
223
|
+
hs.template.get("tmpl_123")
|
|
224
|
+
|
|
225
|
+
# Schemas
|
|
226
|
+
hs.schema.list()
|
|
227
|
+
hs.schema.create(name="Order Schema", schema={...})
|
|
228
|
+
hs.schema.validate("schema_123", {"order_id": "123"})
|
|
229
|
+
|
|
230
|
+
# Alerts
|
|
231
|
+
hs.alert.list()
|
|
232
|
+
hs.alert.create(name="...", condition="failure_rate", threshold=10, channels=["email"])
|
|
233
|
+
|
|
234
|
+
# Connectors
|
|
235
|
+
hs.connector.list()
|
|
236
|
+
hs.connector.list_configs()
|
|
237
|
+
|
|
238
|
+
# Stream
|
|
239
|
+
hs.stream.list_channels()
|
|
240
|
+
hs.stream.publish(channel_id="ch_123", event="test", data={...})
|
|
241
|
+
|
|
242
|
+
# Background Tasks
|
|
243
|
+
hs.background_task.list()
|
|
244
|
+
hs.background_task.get("task_123")
|
|
245
|
+
|
|
246
|
+
# Integrations
|
|
247
|
+
hs.integration.list()
|
|
248
|
+
|
|
249
|
+
# Service Tokens
|
|
250
|
+
hs.service_token.list()
|
|
251
|
+
|
|
252
|
+
# Operational Webhooks
|
|
253
|
+
hs.operational_webhook.list()
|
|
254
|
+
|
|
255
|
+
# Search
|
|
256
|
+
hs.search.deliveries("order.created")
|
|
257
|
+
|
|
258
|
+
# Health
|
|
259
|
+
hs.health.check()
|
|
260
|
+
hs.health.outbound_ips()
|
|
261
|
+
|
|
262
|
+
# User
|
|
263
|
+
hs.me()
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Configuration
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
hs = HookSniff(
|
|
270
|
+
"hr_live_...",
|
|
271
|
+
base_url="https://your-instance.com", # Custom API URL
|
|
272
|
+
timeout=30, # Request timeout (seconds)
|
|
273
|
+
retries=3, # Max retries on 5xx/429
|
|
274
|
+
headers={"X-Custom": "value"}, # Custom headers
|
|
275
|
+
)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Requirements
|
|
279
|
+
|
|
280
|
+
- Python 3.8+
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# HookSniff Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python SDK for [HookSniff](https://hooksniff.vercel.app) — the webhook infrastructure for developers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install hooksniff
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from hooksniff import HookSniff
|
|
15
|
+
|
|
16
|
+
hs = HookSniff("hr_live_...")
|
|
17
|
+
|
|
18
|
+
# Create an application
|
|
19
|
+
app = hs.application.create(name="My App")
|
|
20
|
+
|
|
21
|
+
# Create an endpoint
|
|
22
|
+
ep = hs.endpoint.create(
|
|
23
|
+
url="https://app.com/webhook",
|
|
24
|
+
application_id=app["id"],
|
|
25
|
+
description="Order notifications",
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Send a webhook
|
|
29
|
+
delivery = hs.webhook.send(
|
|
30
|
+
endpoint_id=ep["id"],
|
|
31
|
+
event="order.created",
|
|
32
|
+
data={"order_id": "12345", "amount": 99.99},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
print(delivery["id"]) # "msg_..."
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Simple API** — 2 lines to send a webhook
|
|
41
|
+
- **Auto-pagination** — Iterate through all resources automatically
|
|
42
|
+
- **Auto-retry** — Exponential backoff on 429/5xx errors
|
|
43
|
+
- **Idempotency** — Built-in idempotency key support
|
|
44
|
+
- **Webhook verification** — Verify incoming webhooks (Standard Webhooks compliant)
|
|
45
|
+
- **Error handling** — Typed exceptions
|
|
46
|
+
- **27+ Resources** — Application, Endpoint, Webhook, Billing, Cortex, Teams, and more
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Applications
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
# Create
|
|
54
|
+
app = hs.application.create(name="My App", description="My application")
|
|
55
|
+
|
|
56
|
+
# List with auto-pagination
|
|
57
|
+
for app in hs.application.list():
|
|
58
|
+
print(app["name"])
|
|
59
|
+
|
|
60
|
+
# Get
|
|
61
|
+
app = hs.application.get("app_123")
|
|
62
|
+
|
|
63
|
+
# Update
|
|
64
|
+
app = hs.application.update("app_123", name="New Name")
|
|
65
|
+
|
|
66
|
+
# Delete
|
|
67
|
+
hs.application.delete("app_123")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Endpoints
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
# Create
|
|
74
|
+
ep = hs.endpoint.create(
|
|
75
|
+
url="https://app.com/webhook",
|
|
76
|
+
application_id="app_123",
|
|
77
|
+
description="Order notifications",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# List with auto-pagination
|
|
81
|
+
for ep in hs.endpoint.list():
|
|
82
|
+
print(ep["url"])
|
|
83
|
+
|
|
84
|
+
# Get
|
|
85
|
+
ep = hs.endpoint.get("ep_123")
|
|
86
|
+
|
|
87
|
+
# Update
|
|
88
|
+
ep = hs.endpoint.update("ep_123", url="https://new-url.com/webhook")
|
|
89
|
+
|
|
90
|
+
# Delete
|
|
91
|
+
hs.endpoint.delete("ep_123")
|
|
92
|
+
|
|
93
|
+
# Rotate signing secret
|
|
94
|
+
secret = hs.endpoint.rotate_secret("ep_123")
|
|
95
|
+
print(secret["signing_secret"]) # "whsec_..."
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Webhooks
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
# Send a webhook
|
|
102
|
+
delivery = hs.webhook.send(
|
|
103
|
+
endpoint_id="ep_123",
|
|
104
|
+
event="order.created",
|
|
105
|
+
data={"order_id": "12345", "amount": 99.99},
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Send with idempotency key
|
|
109
|
+
delivery = hs.webhook.send(
|
|
110
|
+
endpoint_id="ep_123",
|
|
111
|
+
event="order.created",
|
|
112
|
+
data={},
|
|
113
|
+
idempotency_key="unique-key-123",
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# Send batch
|
|
117
|
+
result = hs.webhook.send_batch([
|
|
118
|
+
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "1"}},
|
|
119
|
+
{"endpoint_id": "ep_123", "event": "order.created", "data": {"id": "2"}},
|
|
120
|
+
])
|
|
121
|
+
|
|
122
|
+
# List deliveries with auto-pagination
|
|
123
|
+
for d in hs.webhook.list(per_page=10):
|
|
124
|
+
print(d["status"])
|
|
125
|
+
|
|
126
|
+
# Get delivery
|
|
127
|
+
delivery = hs.webhook.get("msg_123")
|
|
128
|
+
|
|
129
|
+
# Replay delivery
|
|
130
|
+
delivery = hs.webhook.replay("msg_123")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Webhook Verification
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from hooksniff import Webhook, WebhookVerificationError
|
|
137
|
+
|
|
138
|
+
wh = Webhook("whsec_...")
|
|
139
|
+
|
|
140
|
+
# In your Flask/FastAPI handler:
|
|
141
|
+
def handle_webhook(request):
|
|
142
|
+
try:
|
|
143
|
+
event = wh.verify(request.body, request.headers)
|
|
144
|
+
print(event)
|
|
145
|
+
return "OK", 200
|
|
146
|
+
except WebhookVerificationError:
|
|
147
|
+
return "Invalid signature", 401
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Error Handling
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from hooksniff import AuthenticationError, NotFoundError, RateLimitError
|
|
154
|
+
|
|
155
|
+
try:
|
|
156
|
+
hs.endpoint.get("invalid_id")
|
|
157
|
+
except NotFoundError:
|
|
158
|
+
print("Endpoint not found")
|
|
159
|
+
except AuthenticationError:
|
|
160
|
+
print("Invalid API key")
|
|
161
|
+
except RateLimitError as e:
|
|
162
|
+
print(f"Rate limited, retry after {e.retry_after}s")
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### All Resources
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
# API Keys
|
|
169
|
+
hs.api_key.list()
|
|
170
|
+
hs.api_key.create(name="Production Key")
|
|
171
|
+
hs.api_key.delete("key_123")
|
|
172
|
+
|
|
173
|
+
# Analytics
|
|
174
|
+
hs.analytics.deliveries(range="24h")
|
|
175
|
+
hs.analytics.success_rate(range="7d")
|
|
176
|
+
|
|
177
|
+
# Billing
|
|
178
|
+
hs.billing.subscription()
|
|
179
|
+
hs.billing.upgrade(plan="pro")
|
|
180
|
+
hs.billing.portal()
|
|
181
|
+
|
|
182
|
+
# Teams
|
|
183
|
+
hs.team.list()
|
|
184
|
+
hs.team.create(name="Engineering")
|
|
185
|
+
|
|
186
|
+
# Cortex AI
|
|
187
|
+
hs.cortex.insights()
|
|
188
|
+
hs.cortex.anomalies(endpoint_id="ep_123")
|
|
189
|
+
hs.cortex.predict("ep_123")
|
|
190
|
+
hs.cortex.auto_heal("ep_123")
|
|
191
|
+
|
|
192
|
+
# Notifications
|
|
193
|
+
hs.notification.list()
|
|
194
|
+
hs.notification.get_unread_count()
|
|
195
|
+
hs.notification.mark_read("notif_123")
|
|
196
|
+
hs.notification.mark_all_read()
|
|
197
|
+
|
|
198
|
+
# Templates
|
|
199
|
+
hs.template.list()
|
|
200
|
+
hs.template.get("tmpl_123")
|
|
201
|
+
|
|
202
|
+
# Schemas
|
|
203
|
+
hs.schema.list()
|
|
204
|
+
hs.schema.create(name="Order Schema", schema={...})
|
|
205
|
+
hs.schema.validate("schema_123", {"order_id": "123"})
|
|
206
|
+
|
|
207
|
+
# Alerts
|
|
208
|
+
hs.alert.list()
|
|
209
|
+
hs.alert.create(name="...", condition="failure_rate", threshold=10, channels=["email"])
|
|
210
|
+
|
|
211
|
+
# Connectors
|
|
212
|
+
hs.connector.list()
|
|
213
|
+
hs.connector.list_configs()
|
|
214
|
+
|
|
215
|
+
# Stream
|
|
216
|
+
hs.stream.list_channels()
|
|
217
|
+
hs.stream.publish(channel_id="ch_123", event="test", data={...})
|
|
218
|
+
|
|
219
|
+
# Background Tasks
|
|
220
|
+
hs.background_task.list()
|
|
221
|
+
hs.background_task.get("task_123")
|
|
222
|
+
|
|
223
|
+
# Integrations
|
|
224
|
+
hs.integration.list()
|
|
225
|
+
|
|
226
|
+
# Service Tokens
|
|
227
|
+
hs.service_token.list()
|
|
228
|
+
|
|
229
|
+
# Operational Webhooks
|
|
230
|
+
hs.operational_webhook.list()
|
|
231
|
+
|
|
232
|
+
# Search
|
|
233
|
+
hs.search.deliveries("order.created")
|
|
234
|
+
|
|
235
|
+
# Health
|
|
236
|
+
hs.health.check()
|
|
237
|
+
hs.health.outbound_ips()
|
|
238
|
+
|
|
239
|
+
# User
|
|
240
|
+
hs.me()
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Configuration
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
hs = HookSniff(
|
|
247
|
+
"hr_live_...",
|
|
248
|
+
base_url="https://your-instance.com", # Custom API URL
|
|
249
|
+
timeout=30, # Request timeout (seconds)
|
|
250
|
+
retries=3, # Max retries on 5xx/429
|
|
251
|
+
headers={"X-Custom": "value"}, # Custom headers
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Requirements
|
|
256
|
+
|
|
257
|
+
- Python 3.8+
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
HookSniff Python SDK - Webhook infrastructure for developers.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
from hooksniff import HookSniff
|
|
6
|
+
|
|
7
|
+
hs = HookSniff("hr_live_...")
|
|
8
|
+
|
|
9
|
+
# Create application
|
|
10
|
+
app = hs.application.create(name="My App")
|
|
11
|
+
|
|
12
|
+
# Create endpoint
|
|
13
|
+
ep = hs.endpoint.create(url="https://app.com/webhook", application_id=app["id"])
|
|
14
|
+
|
|
15
|
+
# Send webhook
|
|
16
|
+
delivery = hs.webhook.send(endpoint_id=ep["id"], event="order.created", data={"id": "123"})
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from .client import HookSniff
|
|
20
|
+
from .webhook import Webhook, WebhookVerificationError
|
|
21
|
+
from .exceptions import (
|
|
22
|
+
HookSniffError,
|
|
23
|
+
AuthenticationError,
|
|
24
|
+
NotFoundError,
|
|
25
|
+
RateLimitError,
|
|
26
|
+
ValidationError,
|
|
27
|
+
ServerError,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__version__ = "0.4.1"
|
|
31
|
+
__all__ = [
|
|
32
|
+
"HookSniff",
|
|
33
|
+
"Webhook",
|
|
34
|
+
"WebhookVerificationError",
|
|
35
|
+
"HookSniffError",
|
|
36
|
+
"AuthenticationError",
|
|
37
|
+
"NotFoundError",
|
|
38
|
+
"RateLimitError",
|
|
39
|
+
"ValidationError",
|
|
40
|
+
"ServerError",
|
|
41
|
+
]
|