cb-events

PyPI version Python versions License Documentation

Async Python client for the Chaturbate Events API.

Example

import asyncio
from cb_events import EventClient, Router, EventType, Event

router = Router()


@router.on(EventType.TIP)
async def handle_tip(event: Event) -> None:
    if event.user and event.tip:
        print(f"{event.user.username} tipped {event.tip.tokens} tokens")


async def main():
    events_url = "https://eventsapi.chaturbate.com/events/username/token/"
    async with EventClient(events_url) as client:
        async for event in client:
            await router.dispatch(event)


asyncio.run(main())

Documentation