Skip to main content

Python client for Relayed, a webhook delivery service

Project description

Relayed

A Python Client for Relayed, a Webhooks Delivery Service.

Installation

pip install relayed

Quick start

import uuid
from relayed import RelayedClient, RelayedClientError

client = RelayedClient(
    api_key="your-api-key",
    base_url="https://relayed.example.com",
    )

subscription = client.create_subscription(
        destination_url="https://example.com",
        event_types=["invoice.paid", "invoice.unpaid"],
        description="Subscription for a contractor to send webhook whether customer paid the invoice"
    )
try:
    response = client.send_event(
        event_type="invoice.paid",
        payload={"invoice_id": "inv_123", "amount": 4200},
        idempotency_key=str(uuid.uuid4()),  # use a stable value across retries
    )
    print(response)  # {"event_id": "...", "delivery_ids": [...]}
except RelayedClientError as e:
    print(f"Cannot send event: {e}")

Error Handling

All errors raised by the SDK inherit from RelayedError, so you can catch everything with a single except clause, or catch specific subclasses for fine-grained handling.

from relayed import (
    RelayedError,
    RelayedAuthError,
    RelayedNotFoundError,
    RelayedConflictError,
    RelayedClientError,
    RelayedServerError,
)

Links

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

relayed-0.0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

relayed-0.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file relayed-0.0.1.tar.gz.

File metadata

  • Download URL: relayed-0.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for relayed-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a5e185b7b287670353a263ae2864e83123e0bf1ee83b3d079a470e2ab29bf6d8
MD5 40efd9d96aa19a48ecc84333384c8d26
BLAKE2b-256 18b1444c1c08ce7c527c0e5c1d9fb7592814dbcecd3c20ce521da86f01ba2fa3

See more details on using hashes here.

File details

Details for the file relayed-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: relayed-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for relayed-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e8e2f80891488c8dd04f3ad68ef607b82c2321eebd4b4658067579146c92d877
MD5 a61c6e883f36c8403ace18651950055c
BLAKE2b-256 b4e59be12756dcbb81c987072f62887e8168792ff2dd65d20550ffcd985abafd

See more details on using hashes here.

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