cb-events


Namecb-events JSON
Version 2.4.3 PyPI version JSON
download
home_pageNone
SummaryAn asynchronous client for the Chaturbate Events API.
upload_time2025-10-07 03:01:34
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords api async chaturbate client events real-time streaming webcam
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CB Events

Async Python client for the Chaturbate Events API with real-time event streaming.

[![PyPI](https://img.shields.io/pypi/v/cb-events)](https://pypi.org/project/cb-events/)
[![Python](https://img.shields.io/pypi/pyversions/cb-events)](https://pypi.org/project/cb-events/)
[![License](https://img.shields.io/github/license/MountainGod2/cb-events)](https://github.com/MountainGod2/cb-events/tree/main/LICENSE)

## Installation

```bash
$ uv pip install cb-events
```

## Usage
```python
import asyncio
import os
from cb_events import EventClient, EventRouter, EventType

router = EventRouter()

@router.on(EventType.TIP)
async def handle_tip(event):
    print(f"{event.user.username} tipped {event.tip.tokens} tokens")

@router.on(EventType.CHAT_MESSAGE)
async def handle_chat(event):
    print(f"{event.user.username}: {event.message.message}")

async def main():
    username = os.getenv("CB_USERNAME")
    token = os.getenv("CB_TOKEN")

    async with EventClient(username, token) as client:
        async for event in client:
            await router.dispatch(event)

asyncio.run(main())
```

## Event Types

- `TIP`, `FANCLUB_JOIN`, `MEDIA_PURCHASE`
- `CHAT_MESSAGE`, `PRIVATE_MESSAGE`
- `USER_ENTER`, `USER_LEAVE`, `FOLLOW`, `UNFOLLOW`
- `BROADCAST_START`, `BROADCAST_STOP`, `ROOM_SUBJECT_CHANGE`

## Configuration

Environment variables:

```bash
export CB_USERNAME="username"
export CB_TOKEN="api_token"
```

Direct instantiation:

```python
client = EventClient("username", "token")
```

Configuration options (defaults shown below):

```python
client = EventClient(
    username="your_username",
    token="your_api_token",
    config=EventClientConfig(
        timeout=10                   # Maximum time to wait for events
        use_testbed=False,           # Use Chaturbate testbed URL
        retry_attempts=8,            # Maximum retry attempts
        retry_backoff=1.0,           # Initial backoff delay in seconds
        retry_exponential_base=2.0   # Exponential backoff factor
        retry_max_delay=30.0,        # Maximum delay between retries
        )
    )
```

## Error Handling

```python
from cb_events.exceptions import AuthError, EventsError

try:
    async with EventClient(username, token) as client:
        async for event in client:
            await router.dispatch(event)
except AuthError:
    # Authentication failed
    pass
except EventsError as e:
    # API error
    pass
```

Automatic retry on 429, 5xx status codes. No retry on authentication errors.

## Requirements

- Python ≥3.11
- aiohttp, pydantic, aiolimiter

```bash
$ uv pip compile pyproject.toml -o requirements.txt
```

## License

MIT licensed. See [LICENSE](https://github.com/MountainGod2/cb-events/tree/main/LICENSE).

## Disclaimer

Not affiliated with Chaturbate.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cb-events",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "MountainGod2 <admin@reid.ca>",
    "keywords": "api, async, chaturbate, client, events, real-time, streaming, webcam",
    "author": null,
    "author_email": "MountainGod2 <admin@reid.ca>",
    "download_url": "https://files.pythonhosted.org/packages/55/5f/c0e4fb2dc7d18488e0a9a35005adca17f4a047d317a77414a6f50feeec4c/cb_events-2.4.3.tar.gz",
    "platform": null,
    "description": "# CB Events\n\nAsync Python client for the Chaturbate Events API with real-time event streaming.\n\n[![PyPI](https://img.shields.io/pypi/v/cb-events)](https://pypi.org/project/cb-events/)\n[![Python](https://img.shields.io/pypi/pyversions/cb-events)](https://pypi.org/project/cb-events/)\n[![License](https://img.shields.io/github/license/MountainGod2/cb-events)](https://github.com/MountainGod2/cb-events/tree/main/LICENSE)\n\n## Installation\n\n```bash\n$ uv pip install cb-events\n```\n\n## Usage\n```python\nimport asyncio\nimport os\nfrom cb_events import EventClient, EventRouter, EventType\n\nrouter = EventRouter()\n\n@router.on(EventType.TIP)\nasync def handle_tip(event):\n    print(f\"{event.user.username} tipped {event.tip.tokens} tokens\")\n\n@router.on(EventType.CHAT_MESSAGE)\nasync def handle_chat(event):\n    print(f\"{event.user.username}: {event.message.message}\")\n\nasync def main():\n    username = os.getenv(\"CB_USERNAME\")\n    token = os.getenv(\"CB_TOKEN\")\n\n    async with EventClient(username, token) as client:\n        async for event in client:\n            await router.dispatch(event)\n\nasyncio.run(main())\n```\n\n## Event Types\n\n- `TIP`, `FANCLUB_JOIN`, `MEDIA_PURCHASE`\n- `CHAT_MESSAGE`, `PRIVATE_MESSAGE`\n- `USER_ENTER`, `USER_LEAVE`, `FOLLOW`, `UNFOLLOW`\n- `BROADCAST_START`, `BROADCAST_STOP`, `ROOM_SUBJECT_CHANGE`\n\n## Configuration\n\nEnvironment variables:\n\n```bash\nexport CB_USERNAME=\"username\"\nexport CB_TOKEN=\"api_token\"\n```\n\nDirect instantiation:\n\n```python\nclient = EventClient(\"username\", \"token\")\n```\n\nConfiguration options (defaults shown below):\n\n```python\nclient = EventClient(\n    username=\"your_username\",\n    token=\"your_api_token\",\n    config=EventClientConfig(\n        timeout=10                   # Maximum time to wait for events\n        use_testbed=False,           # Use Chaturbate testbed URL\n        retry_attempts=8,            # Maximum retry attempts\n        retry_backoff=1.0,           # Initial backoff delay in seconds\n        retry_exponential_base=2.0   # Exponential backoff factor\n        retry_max_delay=30.0,        # Maximum delay between retries\n        )\n    )\n```\n\n## Error Handling\n\n```python\nfrom cb_events.exceptions import AuthError, EventsError\n\ntry:\n    async with EventClient(username, token) as client:\n        async for event in client:\n            await router.dispatch(event)\nexcept AuthError:\n    # Authentication failed\n    pass\nexcept EventsError as e:\n    # API error\n    pass\n```\n\nAutomatic retry on 429, 5xx status codes. No retry on authentication errors.\n\n## Requirements\n\n- Python \u22653.11\n- aiohttp, pydantic, aiolimiter\n\n```bash\n$ uv pip compile pyproject.toml -o requirements.txt\n```\n\n## License\n\nMIT licensed. See [LICENSE](https://github.com/MountainGod2/cb-events/tree/main/LICENSE).\n\n## Disclaimer\n\nNot affiliated with Chaturbate.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An asynchronous client for the Chaturbate Events API.",
    "version": "2.4.3",
    "project_urls": {
        "Changelog": "https://github.com/MountainGod2/cb-events/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/MountainGod2/cb-events#readme",
        "Homepage": "https://github.com/MountainGod2/cb-events",
        "Issue Tracker": "https://github.com/MountainGod2/cb-events/issues",
        "Repository": "https://github.com/MountainGod2/cb-events.git"
    },
    "split_keywords": [
        "api",
        " async",
        " chaturbate",
        " client",
        " events",
        " real-time",
        " streaming",
        " webcam"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1c8937b41d77b8370cea5d17561f952b05555e0f0e0e58d8066574a0071139d1",
                "md5": "9735ef8f2626663e5c802c1764bc7799",
                "sha256": "87a9bcd6d24f6ffbd6ac883dbdf12121d93b2a4cf274e67a7cc2f1564f50d25c"
            },
            "downloads": -1,
            "filename": "cb_events-2.4.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9735ef8f2626663e5c802c1764bc7799",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 15068,
            "upload_time": "2025-10-07T03:01:33",
            "upload_time_iso_8601": "2025-10-07T03:01:33.113500Z",
            "url": "https://files.pythonhosted.org/packages/1c/89/37b41d77b8370cea5d17561f952b05555e0f0e0e58d8066574a0071139d1/cb_events-2.4.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "555fc0e4fb2dc7d18488e0a9a35005adca17f4a047d317a77414a6f50feeec4c",
                "md5": "582c625d76ad013a755db0e565a1542a",
                "sha256": "c47aa67b3e4103c3b740602d7b9c3e824580d8059a01de3b983946446c2cbe7b"
            },
            "downloads": -1,
            "filename": "cb_events-2.4.3.tar.gz",
            "has_sig": false,
            "md5_digest": "582c625d76ad013a755db0e565a1542a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 193651,
            "upload_time": "2025-10-07T03:01:34",
            "upload_time_iso_8601": "2025-10-07T03:01:34.637071Z",
            "url": "https://files.pythonhosted.org/packages/55/5f/c0e4fb2dc7d18488e0a9a35005adca17f4a047d317a77414a6f50feeec4c/cb_events-2.4.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-07 03:01:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MountainGod2",
    "github_project": "cb-events",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cb-events"
}
        
Elapsed time: 0.78761s