Example usage

To use chaturbate_poller in a project:

from asyncio import CancelledError
from contextlib import suppress

from chaturbate_poller import ChaturbateClient
from chaturbate_poller.config_manager import ConfigManager
from chaturbate_poller.format_messages import format_message

config_manager = ConfigManager()
username = config_manager.get("CB_USERNAME", "")
token = config_manager.get("CB_TOKEN", "")


async def main():
    async with ChaturbateClient(username, token, testbed=True) as client:
        url = None

        while True:
            response = await client.fetch_events(url)

            for event in response.events:
                message = await format_message(event)
                print(f"{message}")

            url = response.next_url


with suppress(CancelledError, KeyboardInterrupt):
    await main()
mountaingod2 tipped 500 tokens with message: 'WOW!'