Skip to content

Python SDK

The official Python client. Zero dependencies, standard library only.

Terminal window
pip install duta-sdk
from duta import Duta
duta = Duta("duta_live_xxx")
result = duta.emails.send({
"from": "hello@yourdomain.com",
"to": "user@example.com",
"subject": "Welcome",
"html": "<p>Thanks for signing up!</p>",
})
print("Sent:", result["id"])

Methods raise DutaError on failure:

from duta import Duta, DutaError
try:
duta.emails.send({ "from": "...", "to": "...", "subject": "Hi", "text": "Hello" })
except DutaError as e:
print(e.status_code, e.name, e.message)
# e.name: authentication_error | permission_denied | rate_limit_exceeded | ...
  • duta.emails.send(params): send an email. params keys: from, to (str or list), subject, html, text, reply_to, tags.
  • duta.emails.get(email_id): retrieve an email. Requires a full-access key.
  • duta.emails.list(page=1, limit=20): list emails. Requires a full-access key.

Package: pypi.org/project/duta-sdk · Source: github.com/indra-sh/duta-python.