Skip to main content

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.

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)

Source distribution for postscale 1.0.0
File Size Uploaded
postscale-1.0.0.tar.gz 39.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for postscale 1.0.0
File Interpreter ABI Platform
postscale-1.0.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page