Poller for the Chaturbate events API.
Project description
Chaturbate Poller
Chaturbate Poller is an asynchronous Python library designed to interface with the Chaturbate API.
Key Features
- Error Management: Implements error handling and retry logic to manage network inconsistencies.
- Configurable Logging: Detailed logging mechanisms for debugging and monitoring the poller's operations.
- Data Persistence: Integrates with InfluxDB for storing event data, enabling further analysis and monitoring.
Installation
Ensure Python 3.11+ is installed, then run:
pip install chaturbate-poller
Configuration
Create a .env
file at the root with the necessary environment variables:
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
The Chaturbate Poller can be used both as a library and a CLI tool. Below is an example of how to use it as a library to fetch events:
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())
CLI Usage
python -m chaturbate_poller --username <your_username> --token <your_token>
Docker Usage
To run using Docker, pull the latest Docker image and run:
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
Set up a virtual environment and install dependencies for development:
python -m venv .venv
source .venv/bin/activate
pip install poetry
poetry install
Contributing
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
License
Distributed under the MIT License. See LICENSE
for more information.
Acknowledgments
- Chaturbate API
- Python Asyncio Library
- HTTPX for HTTP client capabilities
- InfluxDB for data storage
chaturbate_poller
was created with the help of cookiecutter
and the py-pkgs-cookiecutter
template.
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.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5a02759a82ea32290404e5619240c9811b14db8d5250daa18efdc1643f23ee |
|
MD5 | 008241a843ce2af572a1972970b7e4bc |
|
BLAKE2b-256 | 722736d74387172303086e602fc6721ed9fd2a2b4a10cc9f4b56c450efc1d45b |