Skip to main content

Python SDK for the UseSend API

Project description

UseSend Python SDK

A minimal Python SDK for the UseSend API, mirroring the structure of the JavaScript SDK.

Installation

Install via pip or Poetry:

pip install usesend
# or
poetry add usesend

Usage

from usesend import UseSend, types

# By default: raises UseSendHTTPError on non-2xx.
client = UseSend("us_123")

# 1) TypedDict payload (autocomplete in IDEs). Use dict to pass 'from'.
payload: types.EmailCreate = {
    "to": "test@example.com",
    "from": "no-reply@example.com",
    "subject": "Hello",
    "html": "<strong>Hi!</strong>",
}
resp, _ = client.emails.send(payload=payload)

# 2) Or pass a plain dict (supports 'from')
resp, _ = client.emails.send(payload={
    "to": "test@example.com",
    "from": "no-reply@example.com",
    "subject": "Hello",
    "html": "<strong>Hi!</strong>",
})

# Toggle behavior if desired:
# - raise_on_error=False: return (None, error_dict) instead of raising
# No model parsing occurs; methods return plain dicts following the typed shapes.
client = UseSend("us_123", raise_on_error=False)
raw, err = client.emails.get(email_id="email_123")
if err:
    print("error:", err)
else:
    print("ok:", raw)

Development

This package is managed with Poetry. Models are maintained in-repo under usesend/types.py (readable names). Update this file as the API evolves.

It is published as usesend on PyPI.

Notes

  • Human-friendly models are available under usesend.types (e.g., EmailCreate, Contact, APIError).
  • Endpoint methods accept TypedDict payloads or plain dicts via the payload= keyword.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usesend-0.2.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usesend-0.2.3-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file usesend-0.2.3.tar.gz.

File metadata

  • Download URL: usesend-0.2.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for usesend-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2566b6009f4c9e5fbcc30071a7989848a0ce304f25c0584e2ad35fabbeff2bea
MD5 a7465bff2bfe3e1342ba7c2adaa6c16b
BLAKE2b-256 b168b89ac77df4ec7b8a296f79d85e4418e46c1725c0f760fe3b908d4299a20d

See more details on using hashes here.

File details

Details for the file usesend-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: usesend-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for usesend-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a8ed9dd4c0c26e6e6be1678f105f469a92e699df932c2480f8a476e0d784325a
MD5 175768f2fe2d261973e37f5536033c38
BLAKE2b-256 2f3a5a3b0c99a1e8be13f92ca8132826dc76a3a3cdce33977f89ac7dbd3b8a7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page