The Official Postmark Python SDK.
Project description
postmark-python |
|
The official (Beta) Python SDK for Postmark — send emails, manage bounces, templates, webhooks, and more.
For tutorials and detailed usage, check out the wiki.
For details about the Postmark API in general, see the Postmark developer docs.
Requirements
- Python 3.10+
Installation
Install from PyPI as postmark-python (the Python package you import is still postmark):
pip install postmark-python
Quick Start
The SDK is fully async. All API calls must be awaited.
import asyncio
import os
import postmark
# Tokens are read from the environment here. Optionally: pip install python-dotenv,
# then use load_dotenv() to populate os.environ from a .env file.
async def main():
async with postmark.ServerClient(os.environ["POSTMARK_SERVER_TOKEN"]) as client:
response = await client.outbound.send({
"sender": "sender@example.com",
"to": "recipient@example.com",
"subject": "Hello from Postmark",
"text_body": "Sent with the Postmark Python SDK.",
})
print(f"Sent: {response.message_id}")
asyncio.run(main())
Two Client Types
| Client | Token | Use for |
|---|---|---|
ServerClient |
Server API token | Sending email, bounces, templates, stats, webhooks, streams |
AccountClient |
Account API token | Domains, sender signatures, managing servers, data removals |
import postmark
# Use as async context managers to ensure connections are closed
async with postmark.ServerClient(os.environ["POSTMARK_SERVER_TOKEN"]) as client:
...
async with postmark.AccountClient(os.environ["POSTMARK_ACCOUNT_TOKEN"]) as account:
...
# Or call close() explicitly when done
client = postmark.ServerClient(os.environ["POSTMARK_SERVER_TOKEN"])
await client.close()
Development
git clone https://github.com/ActiveCampaign/postmark-python.git
cd postmark-python
poetry install
poetry run pre-commit install
# Run tests
poetry run pytest
# Lint and type-check
poetry run pre-commit run --all-files
Contributing
- Fork the repository
- Create a feature branch
- Add tests for your changes
- Ensure all checks pass (
poetry run pre-commit run --all-files) - Open a Pull Request
Support
- Issues: GitHub Issues
- Postmark Support: support@postmarkapp.com
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file postmark_python-0.2.4.tar.gz.
File metadata
- Download URL: postmark_python-0.2.4.tar.gz
- Upload date:
- Size: 31.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e2276e9919e1103930760734bde8bd8ae1010361e2c5c26f12e6754b93ad7b7
|
|
| MD5 |
d368326bf9e270f09345c93735825707
|
|
| BLAKE2b-256 |
6ffcc81c52c8472d68d1cae23ee54ff003be7f0f0ac61860ac910862368eef01
|
Provenance
The following attestation bundles were made for postmark_python-0.2.4.tar.gz:
Publisher:
publish.yml on ActiveCampaign/postmark-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postmark_python-0.2.4.tar.gz -
Subject digest:
9e2276e9919e1103930760734bde8bd8ae1010361e2c5c26f12e6754b93ad7b7 - Sigstore transparency entry: 1312142675
- Sigstore integration time:
-
Permalink:
ActiveCampaign/postmark-python@89ab72a987d13d9bec23896f37da13d5413bfafe -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/ActiveCampaign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89ab72a987d13d9bec23896f37da13d5413bfafe -
Trigger Event:
push
-
Statement type:
File details
Details for the file postmark_python-0.2.4-py3-none-any.whl.
File metadata
- Download URL: postmark_python-0.2.4-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3426b93f14730ca2e3b14f870806ff706caa55176269444f81b4c41f46067564
|
|
| MD5 |
6f0731734987aee314ba059510d96933
|
|
| BLAKE2b-256 |
e6f0332fbbcaf7cb7321bc55e5bfffd68a32ae76f418d6fecc74e7ae77f2881b
|
Provenance
The following attestation bundles were made for postmark_python-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on ActiveCampaign/postmark-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
postmark_python-0.2.4-py3-none-any.whl -
Subject digest:
3426b93f14730ca2e3b14f870806ff706caa55176269444f81b4c41f46067564 - Sigstore transparency entry: 1312142770
- Sigstore integration time:
-
Permalink:
ActiveCampaign/postmark-python@89ab72a987d13d9bec23896f37da13d5413bfafe -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/ActiveCampaign
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89ab72a987d13d9bec23896f37da13d5413bfafe -
Trigger Event:
push
-
Statement type: