Skip to main content

Zero-dependency Python client for the Posthorn HTTP API

Project description

python-posthorn

Zero-dependency Python client for Posthorn's HTTP API.

Install locally

pip install -e ./python-posthorn

Basic usage

from python_posthorn import PosthornClient

client = PosthornClient(
    "http://localhost:8888",
    "your-api-key",
    default_path="/api/transactional",
)

response = client.send({"message": "hello"})
print(response)

[!NOTE] The endpoint path and required payload fields are configured per deployment and not fixed by this client. For example, the deployment at example.com:8080 exposes its send endpoint at /api/send and requires both message and subject_line:

client = PosthornClient(
    "http://example.com:8080",
    "your-api-key",
    default_path="/api/send",
)

response = client.send({"message": "hello", "subject_line": "Greetings"})

Check with the operator of your Posthorn instance for its configured path and required fields.

Features

  • GET /healthz
  • GET /metrics
  • authenticated JSON send requests
  • Idempotency-Key support
  • typed 200 success and dry-run responses
  • typed 422 validation errors
  • explicit exception classes for 401, 409, 429, and 502

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

python_posthorn-0.4.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file python_posthorn-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_posthorn-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac721cc2cc85cb764dcfbb3f71debe53465b1dc46454107d15d40c490f2df45a
MD5 7f9826b0f1ce5941f2e3009487b8e231
BLAKE2b-256 d87146bb068de5e594cff788be15c5f9707abce87dc91b00e61bcc6ee3fd22f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_posthorn-0.4.0-py3-none-any.whl:

Publisher: pypi-publish.yml on monperrus/python-posthorn

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