Postscale Python SDK
Official Python SDK for the Postscale email API.
Install
pip install postscale
Send Email
import os
from postscale import Postscale
postscale = Postscale(os.environ["POSTSCALE_API_KEY"])
result = postscale.emails.send({
"from": "hello@example.com",
"to": ["user@example.com"],
"subject": "Welcome to Postscale",
"html_body": "<strong>It works.</strong>",
})
if result.error:
raise RuntimeError(f"{result.error.code}: {result.error.message}")
print(result.data["message_id"])
The SDK keeps Postscale API-native field names. Use html_body, text_body,
template_id, and unsubscribe_scope; the MVP SDK does not add html or
text aliases.
Attachments
from postscale import Postscale, attachment_from_file
postscale = Postscale()
result = postscale.emails.send({
"from": "hello@example.com",
"to": ["user@example.com"],
"subject": "Invoice",
"text_body": "Attached.",
"attachments": [
attachment_from_file("invoice.pdf", "application/pdf"),
],
})
Attachment helpers enforce the documented limits before sending: 10 attachments, 25 MB per attachment, and 50 MB total decoded attachment payload.
Webhook Verification
from postscale import verify_webhook_signature
verified = verify_webhook_signature(
raw_body,
request.headers.get("X-Postscale-Signature"),
[current_secret, previous_secret],
)
if not verified.valid:
return "invalid", 401
The verifier requires the Postscale signature format:
t=<unix_seconds>,v1=<hex_hmac_sha256>, signed over <t>.<raw_body>. It
supports multiple v1= signatures and multiple candidate secrets for rotation
windows.
Metadata
Release files for postscale 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 |
|---|---|---|---|---|
| postscale-1.0.0.tar.gz | 39.8 kB | Without provenance | Details for postscale-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| postscale-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for postscale-1.0.0-py3-none-any.whl |
Total release size: 58.3 kB
Release files / postscale-1.0.0.tar.gz
| Download URL | postscale-1.0.0.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd78de8cb1be4f72fc81db4f7f03e8f54a25d4d9f009d9cef3b7e520ee090065
|
|
BLAKE2b-256 checksum How to use checksums |
28e04cf007816a6659d67a1ad5b580783e7611df3c18adcfac3e13f8330e2aef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / postscale-1.0.0-py3-none-any.whl
| Download URL | postscale-1.0.0-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3557b663cbc41a575f4816a8e9502563f90ed622302215888ee1d5a169980912
|
|
BLAKE2b-256 checksum How to use checksums |
d9c93769a8858a1a0097a77dd4ef6cb5a7d694865aff0a0b972d59d2d593ecbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for postscale 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.