chaturbate-poller


Namechaturbate-poller JSON
Version 5.1.1 PyPI version JSON
download
home_pageNone
SummaryPython library for interacting with the Chaturbate Events API
upload_time2025-07-09 23:07:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords api chaturbate poller python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# Chaturbate Poller

[![Read the Docs](https://img.shields.io/readthedocs/chaturbate-poller?link=https%3A%2F%2Fchaturbate-poller.readthedocs.io%2Fen%2Fstable%2F)](https://chaturbate-poller.readthedocs.io/en/stable/)
[![Codecov Coverage](https://img.shields.io/codecov/c/github/MountainGod2/chaturbate_poller/main?link=https%3A%2F%2Fapp.codecov.io%2Fgh%2FMountainGod2%2Fchaturbate_poller)](https://app.codecov.io/gh/MountainGod2/chaturbate_poller/)
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/MountainGod2/chaturbate_poller?link=https%3A%2F%2Fwww.codefactor.io%2Frepository%2Fgithub%2Fmountaingod2%2Fchaturbate_poller)](https://www.codefactor.io/repository/github/mountaingod2/chaturbate_poller)
[![Workflow Status](https://img.shields.io/github/actions/workflow/status/MountainGod2/chaturbate_poller/cd.yml?branch=main&link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller%2Factions%2Fworkflows%2Fcd.yml)](https://github.com/MountainGod2/chaturbate_poller/actions/workflows/cd.yml/)
[![License](https://img.shields.io/pypi/l/chaturbate-poller?link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller)](https://github.com/MountainGod2/chaturbate_poller?tab=MIT-1-ov-file)

[![Python Version](https://img.shields.io/pypi/pyversions/chaturbate-poller?link=https%3A%2F%2Fwww.python.org%2Fdownloads%2F)](https://www.python.org/downloads/)
[![PyPI Version](https://img.shields.io/pypi/v/chaturbate-poller?link=https%3A%2F%2Fpypi.org%2Fproject%2Fchaturbate-poller%2F)](https://pypi.org/project/chaturbate-poller/)
[![Docker Image Version](https://img.shields.io/docker/v/mountaingod2/chaturbate_poller?sort=semver&label=docker&link=https%3A%2F%2Fhub.docker.com%2Fr%2Fmountaingod2%2Fchaturbate_poller)](https://hub.docker.com/r/mountaingod2/chaturbate_poller)
[![Docker Image Size](https://img.shields.io/docker/image-size/mountaingod2/chaturbate_poller?sort=semver&arch=amd64&link=https%3A%2F%2Fhub.docker.com%2Fr%2Fmountaingod2%2Fchaturbate_poller%2Ftags)](https://hub.docker.com/r/mountaingod2/chaturbate_poller)

</div>

Python library and CLI tool for interacting with the Chaturbate Events API. Monitor and analyze chat activity, tips, room status changes, and other events in real-time with support for structured logging, automated error handling, and optional InfluxDB integration.

## Features

- **Real-time Event Tracking**
  - Monitor chat messages, tips, room status changes, and other events
  - Configurable polling intervals with automatic rate limiting
  - Support for both production and testbed environments

- **Unified Configuration**
  - Centralized configuration management with validated options
  - Consistent handling across CLI and programmatic interfaces
  - Environment-based configuration with `.env` file support

- **Error Handling**
  - Automatic retries with exponential backoff for transient errors
  - Error classification and reporting
  - Connection recovery after network interruptions

- **Event Processing**
  - Event message formatting with enum-based event types
  - Rich, structured event messages for readability
  - Extensible formatting system for custom event handling

- **Logging**
  - Structured JSON logs for machine parsing in non-TTY environments
  - Rich console output with formatting
  - Configurable verbosity levels

- **Data Persistence & Analytics**
  - Optional InfluxDB integration for time-series storage
  - Pre-configured sample queries for common analytics
  - Docker build and runtime setup

## Installation

Here are a few ways to install the package:

### Using uv (Recommended)

Install with [uv](https://github.com/astral-sh/uv):

```bash
uv pip install chaturbate-poller
```

### Using pip

Make sure you have Python 3.12+ installed:

```bash
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install the package
pip install chaturbate-poller
```

### Using uvx (CLI tool isolation)

Run the CLI without installing it in your Python environment:

```bash
uvx chaturbate_poller start
```

### Environment Configuration (Optional)

Create a `.env` file with your credentials:

```ini
# Required for API access
CB_USERNAME="your_chaturbate_username"
CB_TOKEN="your_chaturbate_token"

# Optional: InfluxDB settings (if using --database flag)
INFLUXDB_URL="http://influxdb:8086"
INFLUXDB_TOKEN="your_influxdb_token"
INFLUXDB_ORG="chaturbate-poller"
INFLUXDB_BUCKET="my-bucket"
USE_DATABASE="false"  # Set to "true" to enable InfluxDB integration
```

**API Token:** You'll need to generate your token at [chaturbate.com/statsapi/authtoken/](https://chaturbate.com/statsapi/authtoken/) with "Events API" permission enabled.

## Quick Start

```bash
# With uv
uv run chaturbate_poller start --username your_username --token your_token

# Using testbed mode (for development/testing)
uv run chaturbate_poller start --testbed --verbose

# With pip installation
python -m chaturbate_poller start --username your_username --token your_token
```

## Usage

### CLI Usage

The CLI uses a unified configuration system for validation:

```bash
chaturbate_poller start [OPTIONS]
```

#### Common Options

| Option                       | Description                    | Default          |
| ---------------------------- | ------------------------------ | ---------------- |
| `--username TEXT`            | Your Chaturbate username       | From `.env` file |
| `--token TEXT`               | Your API token                 | From `.env` file |
| `--timeout FLOAT`            | API request timeout in seconds | 10.0             |
| `--database / --no-database` | Enable InfluxDB integration    | Disabled         |
| `--testbed / --no-testbed`   | Use testbed environment        | Disabled         |
| `--verbose / --no-verbose`   | Enable detailed logging        | Disabled         |
| `--help`                     | Show help message and exit     |                  |

For a complete list of the available CLI options:

```bash
chaturbate_poller --help
```

### Docker

Run with dependency management and health monitoring:

```bash
# Pull the latest image
docker pull ghcr.io/mountaingod2/chaturbate_poller:latest

# Run with environment variables
docker run -d \
  --name chaturbate-poller \
  -e CB_USERNAME="your_chaturbate_username" \
  -e CB_TOKEN="your_chaturbate_token" \
  ghcr.io/mountaingod2/chaturbate_poller:latest --verbose
```

### Docker Compose

For a complete setup including InfluxDB for data persistence:

1. **Clone the configuration:**

   ```bash
   # Copy the example environment file
   cp .env.example .env

   # Edit with your credentials
   nano .env
   ```

2. **Launch the services:**

   ```bash
   docker-compose up -d
   ```

3. **Pass additional arguments**:

   ```bash
   POLLER_ARGS="--verbose --testbed" docker-compose up -d
   ```

4. **Access InfluxDB** at [http://localhost:8086](http://localhost:8086)

## InfluxDB Integration

When enabled with the `--database` flag, events are stored in InfluxDB for analytics and visualization.

### Sample Queries

Here are some useful InfluxDB Flux queries to analyze your Chaturbate data:

```text
// Event count by type (last 24 hours)
from(bucket: "events")
  |> range(start: -24h)
  |> filter(fn: (r) => r._measurement == "chaturbate_events")
  |> filter(fn: (r) => r._field == "method")
  |> group(columns: ["_value"])
  |> count()
  |> sort(columns: ["_value"], desc: true)

// Total tips received (last 7 days)
from(bucket: "events")
  |> range(start: -7d)
  |> filter(fn: (r) => r._measurement == "chaturbate_events")
  |> filter(fn: (r) => r.method == "tip")
  |> filter(fn: (r) => r._field == "object.tip.tokens")
  |> sum()

// Top chatters by message count (last 24 hours)
from(bucket: "events")
  |> range(start: -24h)
  |> filter(fn: (r) => r._measurement == "chaturbate_events")
  |> filter(fn: (r) => r.method == "chatMessage")
  |> filter(fn: (r) => r._field == "object.user.username")
  |> group(columns: ["_value"])
  |> count()
  |> sort(columns: ["_value"], desc: true)
  |> limit(n: 10)
```

For more examples, check out the `/config/chaturbate_poller/influxdb_queries.flux` file.

## Programmatic Usage

You can integrate the library into your own Python applications:

### Basic Example

```python
import asyncio
from chaturbate_poller import ChaturbateClient

async def main():
    async with ChaturbateClient("your_username", "your_token") as client:
        url = None
        while True:
            response = await client.fetch_events(url)
            for event in response.events:
                # Process each event
                print(f"Event type: {event.method}")
                print(event.model_dump_json(indent=2))

            # Use the next URL for pagination
            url = response.next_url

if __name__ == "__main__":
    asyncio.run(main())
```

### Event Formatting

The library includes event message formatting:

```python
import asyncio
from chaturbate_poller import ChaturbateClient, format_message

async def main():
    async with ChaturbateClient("your_username", "your_token") as client:
        url = None
        while True:
            response = await client.fetch_events(url)
            for event in response.events:
                # Format events using the system
                formatted_message = format_message(event)
                if formatted_message:
                    print(formatted_message)
                else:
                    print(f"Unformatted event: {event.method}")

            url = response.next_url

if __name__ == "__main__":
    asyncio.run(main())
```

### Custom Event Handlers

```python
import asyncio
from chaturbate_poller import ChaturbateClient, format_message
from chaturbate_poller.models.event import Event

async def handle_tip(event: Event) -> None:
    """Process tip events."""
    if event.object.user and event.object.tip:
        formatted_message = format_message(event)
        print(formatted_message)

        # Custom logic for large tips
        amount = event.object.tip.tokens
        if amount >= 100:
            await send_special_thanks(event.object.user.username)

async def handle_chat(event: Event) -> None:
    """Process chat messages."""
    formatted_message = format_message(event)
    if formatted_message:
        print(formatted_message)

async def send_special_thanks(username: str) -> None:
    """Send special thanks for large tips."""
    print(f"Special thanks to {username} for the generous tip!")

async def main():
    async with ChaturbateClient("your_username", "your_token") as client:
        url = None
        while True:
            response = await client.fetch_events(url)
            for event in response.events:
                if event.method == "tip":
                    await handle_tip(event)
                elif event.method == "chatMessage":
                    await handle_chat(event)
                else:
                    formatted_message = format_message(event)
                    if formatted_message:
                        print(formatted_message)
            url = response.next_url

if __name__ == "__main__":
    asyncio.run(main())
```

### With InfluxDB Integration

```python
import asyncio
from chaturbate_poller import ChaturbateClient, format_message
from chaturbate_poller.database.influxdb_handler import InfluxDBHandler

async def main():
    influx_handler = InfluxDBHandler()

    async with ChaturbateClient("your_username", "your_token") as client:
        url = None
        while True:
            response = await client.fetch_events(url)
            for event in response.events:
                formatted_message = format_message(event)
                if formatted_message:
                    print(formatted_message)

                # Store in InfluxDB if configured
                if influx_handler.url:
                    influx_handler.write_event(
                        measurement="chaturbate_events",
                        data=event.model_dump()
                    )
            url = response.next_url

if __name__ == "__main__":
    asyncio.run(main())
```

## Development

### Setup Development Environment

1. **Clone the repository:**

   ```bash
   git clone https://github.com/MountainGod2/chaturbate_poller.git
   cd chaturbate_poller
   ```

2. **Install dependencies:**

   ```bash
   # Using uv (recommended)
   uv sync --all-extras

   # Or using pip
   pip install -e ".[dev,docs]"
   ```

3. **Set up pre-commit hooks:**

   ```bash
   uv run pre-commit install
   ```

### Running Tests

```bash
# Run all tests with coverage
uv run pytest --cov-report=html --cov-report=term-missing --cov-report=xml
```

## Documentation

### Building Docs Locally

```bash
# Install documentation dependencies
uv sync --group=docs

# Build HTML documentation
uv run sphinx-build -b html docs docs/_build/html
```

Then open `docs/_build/html/index.html` in your browser.

### Online Documentation

Visit the [documentation](https://chaturbate-poller.readthedocs.io/) for Jupyter notebook example and API reference.

## Changelog

View the complete [CHANGELOG.md](CHANGELOG.md) for version history and updates.

## Contributing

Contributions are welcome! Here's how to get started:

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes with appropriate tests
4. Run linting and tests (`pre-commit run --all-files`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to your branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

For more details, please read the [Contributing Guidelines](CONTRIBUTING.md).

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "chaturbate-poller",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "api, chaturbate, poller, python",
    "author": null,
    "author_email": "MountainGod2 <admin@reid.ca>",
    "download_url": "https://files.pythonhosted.org/packages/00/82/dca2e36e0773e05f268fd0bc0dd17883af93f28c568f094627e0e69a4a20/chaturbate_poller-5.1.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# Chaturbate Poller\n\n[![Read the Docs](https://img.shields.io/readthedocs/chaturbate-poller?link=https%3A%2F%2Fchaturbate-poller.readthedocs.io%2Fen%2Fstable%2F)](https://chaturbate-poller.readthedocs.io/en/stable/)\n[![Codecov Coverage](https://img.shields.io/codecov/c/github/MountainGod2/chaturbate_poller/main?link=https%3A%2F%2Fapp.codecov.io%2Fgh%2FMountainGod2%2Fchaturbate_poller)](https://app.codecov.io/gh/MountainGod2/chaturbate_poller/)\n[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/MountainGod2/chaturbate_poller?link=https%3A%2F%2Fwww.codefactor.io%2Frepository%2Fgithub%2Fmountaingod2%2Fchaturbate_poller)](https://www.codefactor.io/repository/github/mountaingod2/chaturbate_poller)\n[![Workflow Status](https://img.shields.io/github/actions/workflow/status/MountainGod2/chaturbate_poller/cd.yml?branch=main&link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller%2Factions%2Fworkflows%2Fcd.yml)](https://github.com/MountainGod2/chaturbate_poller/actions/workflows/cd.yml/)\n[![License](https://img.shields.io/pypi/l/chaturbate-poller?link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller)](https://github.com/MountainGod2/chaturbate_poller?tab=MIT-1-ov-file)\n\n[![Python Version](https://img.shields.io/pypi/pyversions/chaturbate-poller?link=https%3A%2F%2Fwww.python.org%2Fdownloads%2F)](https://www.python.org/downloads/)\n[![PyPI Version](https://img.shields.io/pypi/v/chaturbate-poller?link=https%3A%2F%2Fpypi.org%2Fproject%2Fchaturbate-poller%2F)](https://pypi.org/project/chaturbate-poller/)\n[![Docker Image Version](https://img.shields.io/docker/v/mountaingod2/chaturbate_poller?sort=semver&label=docker&link=https%3A%2F%2Fhub.docker.com%2Fr%2Fmountaingod2%2Fchaturbate_poller)](https://hub.docker.com/r/mountaingod2/chaturbate_poller)\n[![Docker Image Size](https://img.shields.io/docker/image-size/mountaingod2/chaturbate_poller?sort=semver&arch=amd64&link=https%3A%2F%2Fhub.docker.com%2Fr%2Fmountaingod2%2Fchaturbate_poller%2Ftags)](https://hub.docker.com/r/mountaingod2/chaturbate_poller)\n\n</div>\n\nPython library and CLI tool for interacting with the Chaturbate Events API. Monitor and analyze chat activity, tips, room status changes, and other events in real-time with support for structured logging, automated error handling, and optional InfluxDB integration.\n\n## Features\n\n- **Real-time Event Tracking**\n  - Monitor chat messages, tips, room status changes, and other events\n  - Configurable polling intervals with automatic rate limiting\n  - Support for both production and testbed environments\n\n- **Unified Configuration**\n  - Centralized configuration management with validated options\n  - Consistent handling across CLI and programmatic interfaces\n  - Environment-based configuration with `.env` file support\n\n- **Error Handling**\n  - Automatic retries with exponential backoff for transient errors\n  - Error classification and reporting\n  - Connection recovery after network interruptions\n\n- **Event Processing**\n  - Event message formatting with enum-based event types\n  - Rich, structured event messages for readability\n  - Extensible formatting system for custom event handling\n\n- **Logging**\n  - Structured JSON logs for machine parsing in non-TTY environments\n  - Rich console output with formatting\n  - Configurable verbosity levels\n\n- **Data Persistence & Analytics**\n  - Optional InfluxDB integration for time-series storage\n  - Pre-configured sample queries for common analytics\n  - Docker build and runtime setup\n\n## Installation\n\nHere are a few ways to install the package:\n\n### Using uv (Recommended)\n\nInstall with [uv](https://github.com/astral-sh/uv):\n\n```bash\nuv pip install chaturbate-poller\n```\n\n### Using pip\n\nMake sure you have Python 3.12+ installed:\n\n```bash\n# Create and activate virtual environment\npython3 -m venv .venv\nsource .venv/bin/activate\n\n# Install the package\npip install chaturbate-poller\n```\n\n### Using uvx (CLI tool isolation)\n\nRun the CLI without installing it in your Python environment:\n\n```bash\nuvx chaturbate_poller start\n```\n\n### Environment Configuration (Optional)\n\nCreate a `.env` file with your credentials:\n\n```ini\n# Required for API access\nCB_USERNAME=\"your_chaturbate_username\"\nCB_TOKEN=\"your_chaturbate_token\"\n\n# Optional: InfluxDB settings (if using --database flag)\nINFLUXDB_URL=\"http://influxdb:8086\"\nINFLUXDB_TOKEN=\"your_influxdb_token\"\nINFLUXDB_ORG=\"chaturbate-poller\"\nINFLUXDB_BUCKET=\"my-bucket\"\nUSE_DATABASE=\"false\"  # Set to \"true\" to enable InfluxDB integration\n```\n\n**API Token:** You'll need to generate your token at [chaturbate.com/statsapi/authtoken/](https://chaturbate.com/statsapi/authtoken/) with \"Events API\" permission enabled.\n\n## Quick Start\n\n```bash\n# With uv\nuv run chaturbate_poller start --username your_username --token your_token\n\n# Using testbed mode (for development/testing)\nuv run chaturbate_poller start --testbed --verbose\n\n# With pip installation\npython -m chaturbate_poller start --username your_username --token your_token\n```\n\n## Usage\n\n### CLI Usage\n\nThe CLI uses a unified configuration system for validation:\n\n```bash\nchaturbate_poller start [OPTIONS]\n```\n\n#### Common Options\n\n| Option                       | Description                    | Default          |\n| ---------------------------- | ------------------------------ | ---------------- |\n| `--username TEXT`            | Your Chaturbate username       | From `.env` file |\n| `--token TEXT`               | Your API token                 | From `.env` file |\n| `--timeout FLOAT`            | API request timeout in seconds | 10.0             |\n| `--database / --no-database` | Enable InfluxDB integration    | Disabled         |\n| `--testbed / --no-testbed`   | Use testbed environment        | Disabled         |\n| `--verbose / --no-verbose`   | Enable detailed logging        | Disabled         |\n| `--help`                     | Show help message and exit     |                  |\n\nFor a complete list of the available CLI options:\n\n```bash\nchaturbate_poller --help\n```\n\n### Docker\n\nRun with dependency management and health monitoring:\n\n```bash\n# Pull the latest image\ndocker pull ghcr.io/mountaingod2/chaturbate_poller:latest\n\n# Run with environment variables\ndocker run -d \\\n  --name chaturbate-poller \\\n  -e CB_USERNAME=\"your_chaturbate_username\" \\\n  -e CB_TOKEN=\"your_chaturbate_token\" \\\n  ghcr.io/mountaingod2/chaturbate_poller:latest --verbose\n```\n\n### Docker Compose\n\nFor a complete setup including InfluxDB for data persistence:\n\n1. **Clone the configuration:**\n\n   ```bash\n   # Copy the example environment file\n   cp .env.example .env\n\n   # Edit with your credentials\n   nano .env\n   ```\n\n2. **Launch the services:**\n\n   ```bash\n   docker-compose up -d\n   ```\n\n3. **Pass additional arguments**:\n\n   ```bash\n   POLLER_ARGS=\"--verbose --testbed\" docker-compose up -d\n   ```\n\n4. **Access InfluxDB** at [http://localhost:8086](http://localhost:8086)\n\n## InfluxDB Integration\n\nWhen enabled with the `--database` flag, events are stored in InfluxDB for analytics and visualization.\n\n### Sample Queries\n\nHere are some useful InfluxDB Flux queries to analyze your Chaturbate data:\n\n```text\n// Event count by type (last 24 hours)\nfrom(bucket: \"events\")\n  |> range(start: -24h)\n  |> filter(fn: (r) => r._measurement == \"chaturbate_events\")\n  |> filter(fn: (r) => r._field == \"method\")\n  |> group(columns: [\"_value\"])\n  |> count()\n  |> sort(columns: [\"_value\"], desc: true)\n\n// Total tips received (last 7 days)\nfrom(bucket: \"events\")\n  |> range(start: -7d)\n  |> filter(fn: (r) => r._measurement == \"chaturbate_events\")\n  |> filter(fn: (r) => r.method == \"tip\")\n  |> filter(fn: (r) => r._field == \"object.tip.tokens\")\n  |> sum()\n\n// Top chatters by message count (last 24 hours)\nfrom(bucket: \"events\")\n  |> range(start: -24h)\n  |> filter(fn: (r) => r._measurement == \"chaturbate_events\")\n  |> filter(fn: (r) => r.method == \"chatMessage\")\n  |> filter(fn: (r) => r._field == \"object.user.username\")\n  |> group(columns: [\"_value\"])\n  |> count()\n  |> sort(columns: [\"_value\"], desc: true)\n  |> limit(n: 10)\n```\n\nFor more examples, check out the `/config/chaturbate_poller/influxdb_queries.flux` file.\n\n## Programmatic Usage\n\nYou can integrate the library into your own Python applications:\n\n### Basic Example\n\n```python\nimport asyncio\nfrom chaturbate_poller import ChaturbateClient\n\nasync def main():\n    async with ChaturbateClient(\"your_username\", \"your_token\") as client:\n        url = None\n        while True:\n            response = await client.fetch_events(url)\n            for event in response.events:\n                # Process each event\n                print(f\"Event type: {event.method}\")\n                print(event.model_dump_json(indent=2))\n\n            # Use the next URL for pagination\n            url = response.next_url\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Event Formatting\n\nThe library includes event message formatting:\n\n```python\nimport asyncio\nfrom chaturbate_poller import ChaturbateClient, format_message\n\nasync def main():\n    async with ChaturbateClient(\"your_username\", \"your_token\") as client:\n        url = None\n        while True:\n            response = await client.fetch_events(url)\n            for event in response.events:\n                # Format events using the system\n                formatted_message = format_message(event)\n                if formatted_message:\n                    print(formatted_message)\n                else:\n                    print(f\"Unformatted event: {event.method}\")\n\n            url = response.next_url\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Custom Event Handlers\n\n```python\nimport asyncio\nfrom chaturbate_poller import ChaturbateClient, format_message\nfrom chaturbate_poller.models.event import Event\n\nasync def handle_tip(event: Event) -> None:\n    \"\"\"Process tip events.\"\"\"\n    if event.object.user and event.object.tip:\n        formatted_message = format_message(event)\n        print(formatted_message)\n\n        # Custom logic for large tips\n        amount = event.object.tip.tokens\n        if amount >= 100:\n            await send_special_thanks(event.object.user.username)\n\nasync def handle_chat(event: Event) -> None:\n    \"\"\"Process chat messages.\"\"\"\n    formatted_message = format_message(event)\n    if formatted_message:\n        print(formatted_message)\n\nasync def send_special_thanks(username: str) -> None:\n    \"\"\"Send special thanks for large tips.\"\"\"\n    print(f\"Special thanks to {username} for the generous tip!\")\n\nasync def main():\n    async with ChaturbateClient(\"your_username\", \"your_token\") as client:\n        url = None\n        while True:\n            response = await client.fetch_events(url)\n            for event in response.events:\n                if event.method == \"tip\":\n                    await handle_tip(event)\n                elif event.method == \"chatMessage\":\n                    await handle_chat(event)\n                else:\n                    formatted_message = format_message(event)\n                    if formatted_message:\n                        print(formatted_message)\n            url = response.next_url\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### With InfluxDB Integration\n\n```python\nimport asyncio\nfrom chaturbate_poller import ChaturbateClient, format_message\nfrom chaturbate_poller.database.influxdb_handler import InfluxDBHandler\n\nasync def main():\n    influx_handler = InfluxDBHandler()\n\n    async with ChaturbateClient(\"your_username\", \"your_token\") as client:\n        url = None\n        while True:\n            response = await client.fetch_events(url)\n            for event in response.events:\n                formatted_message = format_message(event)\n                if formatted_message:\n                    print(formatted_message)\n\n                # Store in InfluxDB if configured\n                if influx_handler.url:\n                    influx_handler.write_event(\n                        measurement=\"chaturbate_events\",\n                        data=event.model_dump()\n                    )\n            url = response.next_url\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## Development\n\n### Setup Development Environment\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/MountainGod2/chaturbate_poller.git\n   cd chaturbate_poller\n   ```\n\n2. **Install dependencies:**\n\n   ```bash\n   # Using uv (recommended)\n   uv sync --all-extras\n\n   # Or using pip\n   pip install -e \".[dev,docs]\"\n   ```\n\n3. **Set up pre-commit hooks:**\n\n   ```bash\n   uv run pre-commit install\n   ```\n\n### Running Tests\n\n```bash\n# Run all tests with coverage\nuv run pytest --cov-report=html --cov-report=term-missing --cov-report=xml\n```\n\n## Documentation\n\n### Building Docs Locally\n\n```bash\n# Install documentation dependencies\nuv sync --group=docs\n\n# Build HTML documentation\nuv run sphinx-build -b html docs docs/_build/html\n```\n\nThen open `docs/_build/html/index.html` in your browser.\n\n### Online Documentation\n\nVisit the [documentation](https://chaturbate-poller.readthedocs.io/) for Jupyter notebook example and API reference.\n\n## Changelog\n\nView the complete [CHANGELOG.md](CHANGELOG.md) for version history and updates.\n\n## Contributing\n\nContributions are welcome! Here's how to get started:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes with appropriate tests\n4. Run linting and tests (`pre-commit run --all-files`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to your branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\nFor more details, please read the [Contributing Guidelines](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for interacting with the Chaturbate Events API",
    "version": "5.1.1",
    "project_urls": {
        "changelog": "https://github.com/MountainGod2/chaturbate_poller/blob/main/CHANGELOG.md",
        "documentation": "https://mountaingod2.github.io/chaturbate_poller/",
        "homepage": "https://github.com/MountainGod2/chaturbate_poller",
        "issues": "https://github.com/MountainGod2/chaturbate_poller/issues",
        "repository": "https://github.com/MountainGod2/chaturbate_poller"
    },
    "split_keywords": [
        "api",
        " chaturbate",
        " poller",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a4c29c599b96246e93f22713ec2e474032c8a32e4c6b4e0a2dda82bf9f803a27",
                "md5": "13626e48df1736a3c7a1c0338767107b",
                "sha256": "da591ab2479bc4a62d0dd08cca112be7ce23c35a8afdd74bca1719122ef0c445"
            },
            "downloads": -1,
            "filename": "chaturbate_poller-5.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13626e48df1736a3c7a1c0338767107b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 33430,
            "upload_time": "2025-07-09T23:07:15",
            "upload_time_iso_8601": "2025-07-09T23:07:15.221680Z",
            "url": "https://files.pythonhosted.org/packages/a4/c2/9c599b96246e93f22713ec2e474032c8a32e4c6b4e0a2dda82bf9f803a27/chaturbate_poller-5.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0082dca2e36e0773e05f268fd0bc0dd17883af93f28c568f094627e0e69a4a20",
                "md5": "2fb752a841bc4bcd38e238f0210e9941",
                "sha256": "5feca1e9c21a09b1ee2a2e66bf4c4a8640e320e88177c068dcf2783a47a4d778"
            },
            "downloads": -1,
            "filename": "chaturbate_poller-5.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2fb752a841bc4bcd38e238f0210e9941",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 222980,
            "upload_time": "2025-07-09T23:07:18",
            "upload_time_iso_8601": "2025-07-09T23:07:18.069326Z",
            "url": "https://files.pythonhosted.org/packages/00/82/dca2e36e0773e05f268fd0bc0dd17883af93f28c568f094627e0e69a4a20/chaturbate_poller-5.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-09 23:07:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MountainGod2",
    "github_project": "chaturbate_poller",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "chaturbate-poller"
}
        
Elapsed time: 1.57994s