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
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 usesend-0.2.5.tar.gz.
File metadata
- Download URL: usesend-0.2.5.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecb1f6b6a1f22e657bc133c343d418276625a554454246b153e8c7749f096f4a
|
|
| MD5 |
3b8735fc14ec7f0e2de621c35af2f23c
|
|
| BLAKE2b-256 |
58000a581ccd14030319ae7d435a94d4c1bc2c7c3345d5caf13ccadb6a616861
|
File details
Details for the file usesend-0.2.5-py3-none-any.whl.
File metadata
- Download URL: usesend-0.2.5-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11390e8b264fa3003e6aea80f9d45b6d0ae6a2eef68a8c1f72c0333e09683a4f
|
|
| MD5 |
4ff26268f9dffe56278036c1aa26f96b
|
|
| BLAKE2b-256 |
af8da245d68cdae228bb51e67a72e732d7b1371a1702020291e0846aad303b46
|