The official Python SDK wraps the REST API so you can send email in a couple of lines, without building requests by hand. It is published on PyPI as the postwing package.
pip install postwingCreate the client once with your domain token — the same credentials you use for the SMTP relay and the REST API — and reuse it for every send.
from postwing import PostwingSdk
sdk = PostwingSdk(
username="[email protected]",
password="your-token",
) Use send_simple to send a ready-made message. Pass the recipient, sender, subject and the HTML (or plain-text) body.
sdk.send_simple(
recipient="[email protected]",
sender="[email protected]",
subject="Hello",
body="<h1>Welcome aboard!</h1>",
) Use send_tpl to render one of your saved templates by its slug. Provide the language and any placeholder params the template expects.
sdk.send_tpl(
recipient="[email protected]",
sender="[email protected]",
tpl="welcome",
lang="en",
params={"name": "Alex"},
)idempotency_key so retries never send a duplicate. For the full request and response shape, see the API reference.