Skip to main content

opensend Python SDK

Minimal first-party Python SDK for OpenSend transactional email sends with a familiar email API surface.

Use your OpenSend API key (os_...) with OpenSend as a Resend alternative. The SDK keeps selected alias compatibility for migration-oriented code.

Installation

From this repository before the PyPI release:

python -m pip install ./packages/python-sdk

After opensend==0.1.0 is published to PyPI, install with:

python -m pip install opensend==0.1.0

Setup

Use an environment variable instead of hardcoding API keys:

export OPENSEND_API_KEY="os_your_api_key"

For self-hosted OpenSend, point the SDK at your deployment origin. The default hosted origin is https://opensend.namuh.co.

export OPENSEND_BASE_URL="http://localhost:3015"

Send an email

The module-level surface keeps familiar Python email SDK ergonomics:

import os
import opensend

opensend.api_key = os.environ["OPENSEND_API_KEY"]
opensend.base_url = os.environ.get("OPENSEND_BASE_URL", opensend.DEFAULT_BASE_URL)

params: opensend.Emails.SendParams = {
    "from": "hello@yourdomain.com",
    "to": "recipient@example.com",
    "subject": "Hello from OpenSend",
    "html": "<h1>It works!</h1>",
}

email = opensend.Emails.send(params)
print(email["id"])

Python reserves from as a keyword argument name, but dictionary keys can still use the OpenSend JSON field name. If you prefer constructing dictionaries with Python identifiers, the SDK also accepts from_ or from_email and sends that value as JSON from.

params: opensend.SendParams = {
    "from_": "hello@yourdomain.com",
    "to": ["recipient@example.com"],
    "subject": "Hello from OpenSend",
    "text": "It works!",
}

Batch send

result = opensend.Emails.send_batch([
    {
        "from": "hello@yourdomain.com",
        "to": "a@example.com",
        "subject": "Hi A",
        "html": "<p>A</p>",
    },
    {
        "from": "hello@yourdomain.com",
        "to": "b@example.com",
        "subject": "Hi B",
        "html": "<p>B</p>",
    },
])

print(result["data"])

Instance client

import os
from opensend import DEFAULT_BASE_URL, OpenSend

client = OpenSend(
    os.environ["OPENSEND_API_KEY"],
    base_url=os.environ.get("OPENSEND_BASE_URL", DEFAULT_BASE_URL),
)

email = client.emails.send({
    "from": "hello@yourdomain.com",
    "to": "recipient@example.com",
    "subject": "Hello from OpenSend",
    "html": "<h1>It works!</h1>",
})

Resend is also exported as an alias class for migration-oriented code:

from opensend import Resend

client = Resend(os.environ["OPENSEND_API_KEY"], base_url="http://localhost:3015")

Errors

Non-2xx API responses raise opensend.OpenSendError (also exported as opensend.ApiError). The exception keeps OpenSend's public error envelope fields when present.

try:
    opensend.Emails.send(params)
except opensend.OpenSendError as error:
    print(error.status_code, error.code, error.message, error.details)

Supported first slice

  • opensend.Emails.send(params) → POST /emails
  • opensend.Emails.send_batch(params) → POST /emails/batch
  • Bearer API key auth
  • Configurable base URL
  • Optional idempotency_key= request header
  • Typed request/response structures for transactional email sends

This first package intentionally does not implement every OpenSend API resource yet.

Tests

python -m unittest discover packages/python-sdk/tests

Metadata

Release files for opensend 0.1.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 opensend 0.1.0
File Size Uploaded Provenance Actions
opensend-0.1.0.tar.gz 7.1 kB Without provenance Details for opensend-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.4 kB

Release files / opensend-0.1.0.tar.gz

Download URL opensend-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
929e0b3360c1e65c356a9ed8187cfbe9059b396ed019bbd3e23a7a454b78ed36
BLAKE2b-256 checksum
How to use checksums
479e470246458987a05714cc411178c7fa6f3ccae29d1dc4376e9c2bccb22e32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / opensend-0.1.0-py3-none-any.whl

Download URL opensend-0.1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
273b176675d13ee74307eeaaafebbba42fe8765dcbaeee11c8f74326b2fca49b
BLAKE2b-256 checksum
How to use checksums
4b3acd83673dfb10599e0ef8e9b48495c4969a4adfca63cc85d7304d78bf930e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for opensend 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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