import asyncio, os
from nevo import Nevo
async def main():
async with Nevo(token=os.environ["NEVO_API_KEY"]) as client:
@client.on_event()
async def handle(event):
print(event.id, event.type)
if event.email:
print("from:", event.email.from_, "|", event.email.subject)
elif event.webhook:
print(event.webhook.method, event.webhook.path)
await client.run()
asyncio.run(main())
Environment
export NEVO_API_KEY=nvo_live_...
python handler.py
Handler rules
- Must be
async def. - Returning = event handled.
- Raising or exceeding
handler_timeout(default 30s) → logged, stream continues. The event is not re-delivered to the SDK — replay from the dashboard if you need to. - One handler per client. Branch on
event.typeinside it to route by kind.
Reconnects
Automatic, with exponential jittered backoff capped at reconnect_max_backoff (default 30s). Events that arrive while your client is disconnected are available via dashboard replay.