ankow (Python)
The Python client for the Ankow email API — Feature 027, specified in
planning/features/027-python-sdk.md.
pip install ankow
Requires Python 3.10 or newer. No dependencies.
Usage
import os
from ankow import Ankow
ankow = Ankow(os.environ["ANKOW_API_KEY"])
result = ankow.emails.send(
from_="hello@yourdomain.com",
to="someone@example.com",
template_id="tpl_welcome",
variables={"name": "Ada"},
)
message = ankow.emails.get(result.id)
Three things worth knowing
Retries reuse one idempotency key. A retrying client without one sends the
email twice — the first attempt can succeed and still look like a failure. One
key is generated per call and every retry of that call reuses it, so a retry
asks "did this land?" rather than instructing a second send. Pass
idempotency_key yourself to deduplicate across process restarts, the only case
the client cannot cover. Retries apply to connection failures and to
429/500/502/503/504; a 4xx below 429 is never retried.
from_ carries a trailing underscore, because from is a keyword. It is
the only name in this package that does not match the wire, and the wire name is
what goes out. Everything else — template_id, reply_to, failure_reason —
is spelled exactly as the API spells it, because Python and the API are both
snake_case. The Node client needs a two-way casing translation to keep its
error messages honest; this one needs none, which is why it is the smaller of
the two.
status, failure_reason, event type and bounce_kind are open sets.
New values arrive without a major version — queued the day a queue exists,
opened the day tracking does. None of them is an Enum or a Literal, on
purpose: either would turn adding a value into a breaking change for every
caller who matched on it. They are str.
Zero dependencies
A client for two endpoints does not justify pinning requests or httpx into
every project that installs it — that is a version conflict waiting in someone
else's dependency tree — and urllib.request is in the standard library. The
transport is a single callable and is injectable, so tests never open a socket
and a caller who wants connection pooling can supply their own.
Errors
Every failure the API answered raises an AnkowError subclass carrying type,
code, status and request_id — quote that id in any support thread.
A request that never reached the API raises AnkowConnectionError instead,
which is not an AnkowError: it has no request_id, because none exists.
from ankow import AnkowError, RateLimitError
try:
ankow.emails.send(from_="...", to="...", template_id="...")
except RateLimitError as error:
print("retry after", error.retry_after_seconds)
except AnkowError as error:
print(error.code, error.request_id)
Versioning and support
Semantic versioning (MAJOR.MINOR.PATCH), starting at 1.0.0 (D84).
A breaking change — anything that bumps MAJOR — is a change to a method
signature, a request or response field name, an error class name or its place in
the hierarchy, the default retry behaviour, or the minimum supported Python
version. Everything else is MINOR (additive) or PATCH (fixes).
Open sets are not a breaking change. status, failure_reason, event
type and bounce_kind gain values in a MINOR release — none of them is an
Enum or a Literal, on purpose, so adding a value never breaks a caller who
matched on it. They are str.
When the next MAJOR ships, the previous line receives security and
critical-correctness fixes for six months.
Development
uv sync
uv run pytest
uv run ruff check .
uv run mypy
These also run in verify and in scripts/local-ci.sh (stage 8/14), via a
uv step added when TD-079 closed on 2026-09-01.
Metadata
Release files for ankow 1.0.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 |
|---|---|---|---|---|
| ankow-1.0.0.tar.gz | 51.2 kB | Without provenance | Details for ankow-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ankow-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for ankow-1.0.0-py3-none-any.whl |
Total release size: 67.4 kB
Release files / ankow-1.0.0.tar.gz
| Download URL | ankow-1.0.0.tar.gz |
|---|---|
| Size | 51.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d88c544e3ff249be52c6c1aed07472bd73001c7ef8e3fb856cc8b065c326ceb
|
|
BLAKE2b-256 checksum How to use checksums |
5846dcc08a71930462d08a8287fb63043eed4c26e770c2419bf6066d16633c76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / ankow-1.0.0-py3-none-any.whl
| Download URL | ankow-1.0.0-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8588fa1aada28de388f28c7a491eb9f10d628d81c96d4edb1e5b7cf2ac76d9a6
|
|
BLAKE2b-256 checksum How to use checksums |
3940ae983cbcfa976b5070dee90734f02f0685090f7b74da7fb2551c4052406e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for ankow 1.0.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.