Skip to main content

Poller for the Chaturbate events API.

Project description

Chaturbate Poller

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

Chaturbate Poller is a Python library and CLI for polling events from the Chaturbate API. It provides asynchronous event handling, logging, and optional integration with InfluxDB to store event data for analysis.

Features

  • Event Polling: Efficiently poll events from Chaturbate’s API.
  • Error Handling: Includes backoff and retry mechanisms.
  • Logging: Console and JSON file logging for structured insights.
  • Optional InfluxDB Storage: Store events in InfluxDB for analysis or monitoring.

Installation

Ensure Python 3.11 or later is installed, then install via pip:

pip install chaturbate-poller

Configuration

Create a .env file in your project’s root directory for API and InfluxDB credentials:

CB_USERNAME="your_chaturbate_username"
CB_TOKEN="your_chaturbate_token"
INFLUXDB_URL="http://influxdb:8086"
INFLUXDB_TOKEN="your_influxdb_token"
INFLUXDB_ORG="chaturbate-poller"
INFLUXDB_BUCKET="your_bucket"
USE_DATABASE="false"  # Set to `true` if InfluxDB is used

[!NOTE] Generate an API token here with the "Events API" permission enabled.

Usage

CLI

Start the poller from the command line:

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

For additional options:

python -m chaturbate_poller --help

Docker

Run Chaturbate Poller in Docker:

docker pull ghcr.io/mountaingod2/chaturbate_poller:latest
docker run \
  -e CB_USERNAME="your_chaturbate_username" \
  -e CB_TOKEN="your_chaturbate_token" \
  ghcr.io/mountaingod2/chaturbate_poller:latest --verbose --testbed

Library Usage

To use Chaturbate Poller as a library, here's a sample script to fetch events in a loop:

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:
                print(event.dict())  # Process each event

            url = response.next_url

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

Development

  1. Clone the repository:

    git clone https://github.com/MountainGod2/chaturbate_poller.git
    cd chaturbate_poller
    
  2. Set up the environment and dependencies using uv:

    uv venv .venv
    uv pip install -e .
    

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a feature branch.
  3. Submit a pull request, ensuring tests and coding standards are met.

License

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

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-1.1.0.tar.gz (142.2 kB view details)

Uploaded Source

Built Distribution

chaturbate_poller-1.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file chaturbate_poller-1.1.0.tar.gz.

File metadata

  • Download URL: chaturbate_poller-1.1.0.tar.gz
  • Upload date:
  • Size: 142.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for chaturbate_poller-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e0655ab60e8156ffd71bbc0bb7d3605059f6253e2efc9fcfab62d044a31196c5
MD5 238e4649cbddd441dbf80f8c8063f797
BLAKE2b-256 1436635b2a725fc77842000856b63a9ffcd609b792df434b5586869ca0052474

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaturbate_poller-1.1.0.tar.gz:

Publisher: cd.yml on MountainGod2/chaturbate_poller

Attestations:

File details

Details for the file chaturbate_poller-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chaturbate_poller-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2c107203d5d773d1bc344d7a7d58ff34e8d3fa00fa7a7249ab59e35d25f889
MD5 8c3dc1d29ee2451a7ec0d7bcfeace50f
BLAKE2b-256 8471aabdecee4c4d8be8c11e9439cde2e3fbe83e30a53be1c250a1e2a47053be

See more details on using hashes here.

Provenance

The following attestation bundles were made for chaturbate_poller-1.1.0-py3-none-any.whl:

Publisher: cd.yml on MountainGod2/chaturbate_poller

Attestations:

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