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 rootmab.monperrus.net:8088 exposes its send endpoint at /api/send and requires both message and subject_line:

client = PosthornClient(
    "http://rootmab.monperrus.net:8088",
    "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.3.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for python_posthorn-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2208f982735438ba67948583685acb4503281d81032a340e8978ae4426efb604
MD5 bb7b35f7c8e3f9dbe3a820bd7190314f
BLAKE2b-256 cce729349ea75f6b60dcbb892202a2890e097e4180c6dd9fe0d28390f60c15f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_posthorn-0.3.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