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.
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:
- Fork the repository.
- Create a new feature branch.
- 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:
- Chaturbate API
- Python's Asyncio Library
- HTTPX for handling HTTP requests
- InfluxDB for data storage
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
Built Distribution
Hashes for chaturbate_poller-0.10.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b400b60354c5a80d20a96acb3a6e0d1071ec9b3ad6d95a184de37238035d99d |
|
MD5 | 4158fa5d4806d614efd851a0a2b49320 |
|
BLAKE2b-256 | c20e201b8392b9ff765f4c947dbef513475b692162d6ec2c3e3db8ba6a861fd2 |