Skip to main content

Official Python SDK for Hookfreight

Project description

hookfreight

Official Python SDK for Hookfreight.

Capture, inspect, replay, and reliably deliver webhooks with full visibility.

Installation

pip install hookfreight

Quick Start

Hookfreight Cloud

from hookfreight import Hookfreight

hf = Hookfreight(api_key="hf_sk_...")

result = hf.deliveries.list({"limit": 10})
print(result["deliveries"])

Self-Hosted

from hookfreight import Hookfreight

hf = Hookfreight(base_url="http://localhost:3030/api/v1")

Configuration

Option Type Default Description
api_key str API key for Hookfreight Cloud. Optional for self-hosted.
base_url str https://api.hookfreight.com/v1 Base URL of the API. Override for self-hosted.
timeout int 30000 Request timeout in milliseconds.

Usage

from hookfreight import Hookfreight

hf = Hookfreight(api_key="hf_sk_...")

app = hf.apps.create({"name": "My App"})
endpoint = hf.endpoints.create({
    "name": "Stripe",
    "app_id": app["id"],
    "forward_url": "https://example.com/webhooks/stripe",
})

event = hf.events.get("evt_...")
print(event["body"])

stats = hf.deliveries.queue_stats()
print(stats)

Error Handling

from hookfreight import Hookfreight, NotFoundError, ValidationError, ConnectionError

hf = Hookfreight(api_key="hf_sk_...")

try:
    hf.apps.get("app_nonexistent")
except NotFoundError:
    print("App not found")
except ValidationError as err:
    print(err.errors)
except ConnectionError as err:
    print(err)

Examples

  • examples/basic_usage.py
  • examples/manage_endpoints.py
  • examples/retry_failed_deliveries.py
  • examples/monitor_queue.py

Run an example:

HOOKFREIGHT_API_KEY=hf_sk_... python examples/basic_usage.py

License

Apache-2.0

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

hookfreight-0.1.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

hookfreight-0.1.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file hookfreight-0.1.1.tar.gz.

File metadata

  • Download URL: hookfreight-0.1.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hookfreight-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1c689ff391f84636eecb1f3a1624e9b1e272023abdbbfd8df00496b95029b2e4
MD5 97951a502f5633a0b80d4a5ebfb57ca5
BLAKE2b-256 ddc599d3cccc4ac178bf445a4a550ade901489740a8c936dfd25f88af2de1cfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for hookfreight-0.1.1.tar.gz:

Publisher: pypi-publish.yml on HookFreight/hookfreight-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hookfreight-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hookfreight-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hookfreight-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c95a0eed176f5b7ec01f0ddad8f6b26337a336b2a45dc5016915e03d97be71b0
MD5 3e528b0f5f3fabf0d8ec5631d3b499f6
BLAKE2b-256 90a90af1c1793d703dcb038bf317368bea5467827954f597d9c9437b7bc76e66

See more details on using hashes here.

Provenance

The following attestation bundles were made for hookfreight-0.1.1-py3-none-any.whl:

Publisher: pypi-publish.yml on HookFreight/hookfreight-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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