Metadata-Version: 2.5
Name: usend
Version: 1.0.0
Summary: The official Python SDK for usend, the email API for developers.
Project-URL: Homepage, https://usend.et
Project-URL: Documentation, https://usend.et/docs
License-Expression: MIT
License-File: LICENSE
Keywords: email,email api,transactional email,usend,webhooks
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Communications :: Email
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# usend for Python

The official Python SDK for [usend](https://usend.et), the email API for developers.

```bash
pip install usend
```

```python
import os
from usend import Usend

usend = Usend(os.environ["USEND_API_KEY"])

email = usend.emails.send({
    "from": "Acme <hello@acme.com>",
    "to": "ann@example.com",
    "subject": "Your login code",
    "html": "<p>Your code is <b>482913</b></p>",
})
print(email["id"])
```

Methods return the API's JSON as dicts and raise `usend.UsendError` (`status_code`, `name`, `message`).

- Python 3.9 or newer. No dependencies.
- The key defaults to `USEND_API_KEY`; the base URL to `USEND_BASE_URL` or `https://api.usend.et`.
- Resources: `emails`, `batch`, `received`, `templates`, `domains`, `api_keys`, `segments`, `contacts`,
  `broadcasts`, `webhooks`, `suppressions`.

Verify a webhook (pass the raw body):

```python
from usend import verify_webhook

event = verify_webhook(raw_body, request.headers, os.environ["USEND_WEBHOOK_SECRET"])
```

Docs: https://usend.et/docs
