Skip to main content

Poller for the Chaturbate events API.

Project description

Chaturbate Poller

Chaturbate Poller is an asynchronous Python library designed to interface with the Chaturbate API. It allows you to efficiently poll events, handle event data, and optionally store the results in InfluxDB for analysis or monitoring purposes.

Read the Docs Codecov Coverage CodeFactor Grade Workflow Status License Python Version Version

Key Features

  • Resilient Error Handling: Includes retry logic and robust error management to handle intermittent network issues.
  • Customizable Logging: Built-in, configurable logging to help track and debug the poller's operations.
  • Data Persistence: Supports integration with InfluxDB to store event data for further analysis and monitoring.

Installation

Ensure that Python 3.11 or later is installed, then install the package using pip:

pip install chaturbate-poller

Configuration

Before running the poller, configure the environment by creating a .env file at the root of your project. This file should contain your Chaturbate API credentials and optional InfluxDB settings:

CB_USERNAME="your_chaturbate_username"
CB_TOKEN="your_chaturbate_token"
USE_DATABASE="true"
INFLUXDB_URL="http://influxdb:8086"
INFLUXDB_TOKEN="your_influxdb_token"
INFLUXDB_ORG="chaturbate-poller"
INFLUXDB_BUCKET="your_bucket"
INFLUXDB_INIT_MODE="setup"
INFLUXDB_INIT_USERNAME="admin"
INFLUXDB_INIT_PASSWORD="changeme"
INFLUXDB_INIT_ORG="chaturbate-poller"
INFLUXDB_INIT_BUCKET="my-bucket"

Usage

Chaturbate Poller can be used both as a Python library and a command-line tool.

As a Library

Below is a simple example of how to use Chaturbate Poller to fetch events asynchronously:

import asyncio
from chaturbate_poller.chaturbate_client import ChaturbateClient

async def main():
    async with ChaturbateClient('your_username', 'your_token') as client:
        events = await client.fetch_events()
        for event in events:
            print(event)

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

As a Command-Line Tool

You can also run the poller directly from the command line:

python -m chaturbate_poller --username <your_username> --token <your_token>

For a complete list of CLI options, use the --help flag.

python -m chaturbate_poller --help

Docker Usage

Chaturbate Poller is also available as a Docker image. To run it, use the following commands:

docker pull ghcr.io/mountaingod2/chaturbate_poller:latest
docker run \
  -e CB_USERNAME="your_chaturbate_username" \
  -e CB_TOKEN="your_chaturbate_api_token" \
  -e INFLUXDB_URL="http://influxdb:8086" \
  -e INFLUXDB_TOKEN="your_influxdb_token" \
  -e INFLUXDB_ORG="chaturbate-poller" \
  -e INFLUXDB_BUCKET="my-bucket" \
  -v /opt/chaturbate_poller:/app \ # Log storage only
  ghcr.io/mountaingod2/chaturbate_poller:latest --testbed

Development

For development, it's recommended to create a virtual environment and install dependencies with uv:

pip install uv
git clone https://github.com/MountainGod2/chaturbate_poller.git .
cd chaturbate_poller
uv venv .venv
uv pip install .

Contributing

Contributions are always welcome! To contribute:

  1. Fork the repository.
  2. Create a new feature branch.
  3. Submit a pull request.

Please ensure your changes pass all tests and follow the repository's coding standards.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Chaturbate Poller is built using the following technologies:

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaturbate_poller-0.11.6.tar.gz (128.4 kB view hashes)

Uploaded Source

Built Distribution

chaturbate_poller-0.11.6-py3-none-any.whl (20.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page