railhook
Python SDK for Railhook.
pip install railhook
Before 2.12.0 this package was webhook-platform, imported as hookflow. That package gets no
more updates.
Send an event
import os
from railhook import Railhook, Event
client = Railhook(
api_key=os.environ["RAILHOOK_API_KEY"],
base_url="https://railhook.io", # default http://localhost:8080
)
event = client.events.send(
Event(type="order.completed", data={"order_id": "ord_123", "amount": 99.99}),
idempotency_key="order-123-completed", # optional
)
print(event.event_id, event.deliveries_created)
Verify a webhook
The signature covers the raw body, so verify the bytes as received.
import os
from flask import Flask, request
from railhook import construct_event, RailhookError
app = Flask(__name__)
@app.route("/webhooks", methods=["POST"])
def webhook():
try:
event = construct_event(
request.get_data(as_text=True), dict(request.headers), os.environ["WEBHOOK_SECRET"]
)
except RailhookError:
return "Invalid signature", 400
print(event.event_id, event.data)
return "OK", 200
verify_standard_webhook checks the webhook-* headers instead. During a secret rotation
either secret's signature is accepted.
The client also covers endpoints, subscriptions, deliveries, consumers and portal sessions, and incoming sources and events. It does not retry: one call is one HTTP request.
Full docs: https://railhook.io/docs/tools/sdks/
Develop
pip install -e ".[dev]"
pytest
python scripts/live_api_smoke.py # against a running stack (make up)
License
MIT
Metadata
Release files for railhook 3.7.0
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 |
|---|---|---|---|---|
| railhook-3.7.0.tar.gz | 28.5 kB | Without provenance | Details for railhook-3.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| railhook-3.7.0-py3-none-any.whl | Python 3 | none | any | Details for railhook-3.7.0-py3-none-any.whl |
Total release size: 61.8 kB
Release files / railhook-3.7.0.tar.gz
| Download URL | railhook-3.7.0.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f345075fdaa3b1e8cb1be22df4a7e42004ba40b14081291084693a823154587
|
|
BLAKE2b-256 checksum How to use checksums |
4952bb607e1deec52a7e430c00d1dc375fc4ddbc724ab2dc33545ac793c30ad5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / railhook-3.7.0-py3-none-any.whl
| Download URL | railhook-3.7.0-py3-none-any.whl |
|---|---|
| Size | 33.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e4a0be039701dba84d9a9761ebe34e73211ff2bd5b5cdd808712bf1953bae12
|
|
BLAKE2b-256 checksum How to use checksums |
96afb0cbc530f76d5fbaa3c656e77c12b820e62e60bdfaeded4566d632a6cd2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for railhook 3.7.0
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.