Official Python SDK for the Reloop email API. Package name on PyPI: reloop-email.
Version 2.0 is a breaking rewrite aligned with the Node.js SDK: typed params, named Result objects for HTTP errors, and ReloopValidationError for bad client input.
pip install reloop-email
Requires Python 3.9+.
from reloop_email import Reloop with Reloop(api_key="rl_...") as reloop: result = reloop.mail.send({ "from": "[email protected]", "to": "[email protected]", "subject": "Welcome", "html": "<p>Thanks for signing up.</p>", }) if result.email_error: print(result.email_error.status, result.email_error.body.message) else: print(result.response["messageId"])
| Kind | Behavior |
|---|---|
| Invalid arguments | Raises ReloopValidationError (no HTTP call) |
| API / network failure | Returns a named Result (email_error, api_key_error, domain_error, …) — does not raise |
Reloop
├── api_key # create, list, get, update, delete, rotate, enable, disable
├── mail # send
├── contacts # CRUD + .properties / .groups / .channels
├── domain # create, list, get, update, delete, verify
├── webhook # CRUD, pause/enable/disable, trigger, deliveries, verify
└── inbox
├── mailboxes
├── messages
└── threads
Webhook signature verification (local, no HTTP):
from reloop_email import verify_webhook, WEBHOOK_SIGNATURE_HEADER # raw_body: the exact request bytes; signature_header: the Reloop-Signature header event = verify_webhook({ "payload": raw_body, "headers": {WEBHOOK_SIGNATURE_HEADER: signature_header}, "secret": "whsec_...", }) # event: {"id", "type", "created_at", "data"} if event["type"] == "email.received": print(event["data"]["subject"])
API errors carry the fields the API returns: email_error.body.message, .why, .fix and .link.
- API reference: reloop.sh/docs
- Contributing / local development: CONTRIBUTING.md
- HTTP failures no longer raise
ReloopApiErrorfrom service methods; they return named*_errorfields. - Dynamic Stripe-style
Resourceobjects are gone; responses are typed dicts / dataclasses. api_keys→api_key; contacts nesting matches Node (contacts.properties, etc.).- Removed:
domain.get_nameservers,domain.forward_dns,api_keys.pause. ReloopClientis no longer a public constructable export.
Apache License 2.0 with additional use restrictions from Reloop Labs. See LICENSE.