Official Python SDK for the PostStack Email API
Project description
PostStack Python SDK
Official Python SDK for the PostStack Email API — an EU-hosted, GDPR-compliant email API for Python with sync and async clients, full type hints, and drop-in compatibility with Django, FastAPI, Flask, and Starlette. Up to 75% cheaper than Resend, SendGrid, and Postmark.
Docs: poststack.dev/docs/sdk.
Installation
pip install poststack
Requires Python 3.10+.
Quick start
from poststack import PostStack
client = PostStack(api_key="sk_live_...")
result = client.emails.send({
"from": "hello@example.com",
"to": ["user@example.com"],
"subject": "Hello from PostStack",
"html": "<p>Welcome!</p>",
})
print(result["id"])
Async usage
import asyncio
from poststack import AsyncPostStack
async def main():
client = AsyncPostStack(api_key="sk_live_...")
try:
result = await client.emails.send({
"from": "hello@example.com",
"to": ["user@example.com"],
"subject": "Hello from PostStack",
"html": "<p>Welcome!</p>",
})
print(result["id"])
finally:
await client.aclose()
asyncio.run(main())
Or use it as an async context manager:
async with AsyncPostStack(api_key="sk_live_...") as client:
result = await client.emails.send({...})
Error handling
Any non-2xx response raises PostStackError:
from poststack import PostStack, PostStackError
client = PostStack(api_key="sk_live_...")
try:
client.emails.send({"from": "x@y.com", "to": ["z@w.com"], "subject": "hi"})
except PostStackError as e:
print(e.status_code, e.error, e.request_id)
Configuration
client = PostStack(
api_key="sk_live_...",
base_url="https://api.poststack.dev", # default
timeout=30.0, # default (seconds)
)
Override timeout per call:
client.emails.send({...}, timeout=60.0)
Resources
client.emails— send, get, list, cancel, reschedule, batch, events, insightsclient.domains— create, list, get, verify, update, delete, DMARCclient.contacts— CRUD, import, export, unsubscribeclient.contact_properties— custom propertiesclient.segments— create, list, get, update, delete, contacts, previewclient.templates— CRUD, publish, duplicate, presetsclient.webhooks— CRUD, test, deliveries, replayclient.broadcasts— CRUD, send, test, variantsclient.suppressions— list, add, removeclient.api_keys— CRUDclient.mailboxes— CRUD, aliases, passwordclient.subscription_topics— topics + contact subscriptionsclient.workflows— CRUD, steps, activate, pause, triggerclient.signup_forms— CRUD, submitclient.email_validations— validate, validate_batch
Links
- PostStack — EU-hosted email API
- API documentation
- Pricing · Compare providers
- Migrate from Resend · from SendGrid · from Postmark
- Status · Security · DPA
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 poststack-0.4.0.tar.gz.
File metadata
- Download URL: poststack-0.4.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3fda2e08f4709bf08044af369f6d0d62a339864fa523c511dc688060415e6af
|
|
| MD5 |
3ffa364ad6ba7e39809937c001896b19
|
|
| BLAKE2b-256 |
c300cbc86d343fb386ff8687f027a5ef2a2e11c5aab293d1ee28ecfd58834cd4
|
File details
Details for the file poststack-0.4.0-py3-none-any.whl.
File metadata
- Download URL: poststack-0.4.0-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d91192aba02c558926c07dbbc6317173f5865a5a61a6fbe8c667fc2ec437cfb2
|
|
| MD5 |
21535f6acf7bfeb5bcb84c631db4f3b8
|
|
| BLAKE2b-256 |
b2ba5e587cfc38249a1d8260fcf945b4adb4a80a268dc31218b6e33055126dc9
|