The official Python SDK for Reloop, modeled after the Stripe Python SDK with snake_case parameters and typed resource responses.
- Python 3.9 or higher
pip install reloopfrom reloop import Reloop
reloop = Reloop(api_key="re_123456789")
# or
reloop = Reloop.client("re_123456789")reloop = Reloop(api_key="rl_123456789")
reloop.api_keys.list(page=1, limit=10)
reloop.api_keys.create(
name="Production key",
enabled=True,
rate_limit_enabled=True,
)
reloop.api_keys.get("key_123456789")
reloop.api_keys.update("key_123456789", name="Renamed key")
reloop.api_keys.rotate("key_123456789")
reloop.api_keys.disable("key_123456789")
reloop.api_keys.enable("key_123456789")
reloop.api_keys.delete("key_123456789")Manage contacts, custom properties, groups, and channels. Methods accept snake_case keyword arguments and return resource objects with snake_case attributes.
reloop = Reloop(api_key="re_123456789")
contact = reloop.contacts.create(
email="steve.wozniak@gmail.com",
first_name="Steve",
last_name="Wozniak",
unsubscribed=False,
)
print(contact.email)
print(contact.first_name)contacts = reloop.contacts.list(page=1, limit=10)
print(contacts.contacts, contacts.total)
reloop.contacts.update(
"cont_123456789",
first_name="Steve",
unsubscribed=False,
)reloop.contacts.groups.add_contact(
"grp_123456789",
contact_id="cont_123456789",
)
reloop.contacts.channels.create(
name="Product Updates",
default_subscription="opt_in",
)from reloop import Reloop, ReloopApiError
reloop = Reloop(api_key="re_123456789")
try:
reloop.contacts.get("cont_invalid")
except ReloopApiError as error:
print(error.status_code, error.body)with Reloop(api_key="re_123456789") as reloop:
reloop.contacts.list(limit=10)