chaturbate-poller


Namechaturbate-poller JSON
Version 1.8.3 PyPI version JSON
download
home_pageNone
SummaryPoller for the Chaturbate events API.
upload_time2025-02-01 03:49:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 MountainGod2 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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/docker-build.yml?branch=main&link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller%2Factions%2Fworkflows%2Fdocker-build.yml)](https://github.com/MountainGod2/chaturbate_poller/actions/workflows/docker-build.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 polling events from the Chaturbate API featuring asynchronous event handling, structured logging, and optional InfluxDB integration for analytics and monitoring.

---

## Features

- **Event Polling**: Retrieve real-time events from the Chaturbate API.
- **Error Handling**: Built-in retries, exponential backoff, and error classification.
- **Logging**: Supports structured JSON logs and console outputs for better debugging.
- **Optional InfluxDB Integration**: Store and analyze events using InfluxDB.

---

## Installation

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

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

### Environment Configuration (Optional)

Create a `.env` file in your project's root directory with the following:

```text
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="my-bucket"
USE_DATABASE="false"  # Set to `true` if InfluxDB is used
```

> 💡 **Tip**: [Generate an API token here](https://chaturbate.com/statsapi/authtoken/) with "Events API" permission enabled.

---

## Usage

### CLI Usage

Start the poller with the following command:

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

#### Common CLI Options

- `--username`: Your Chaturbate username. Defaults to `.env` file value.
- `--token`: Your API token. Defaults to `.env` file value.
- `--timeout`: Timeout for API requests (default: 10 seconds).
- `--database`: Enable InfluxDB integration. Defaults to disabled.
- `--testbed`: Enable the testbed environment for testing.
- `--verbose`: Enable detailed logging for debugging.

Run `python -m chaturbate_poller --help` for a complete list of options.

### Docker

To run the poller in Docker, pull the image and start the container:

```bash
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 --database
```

---

## Programmatic Usage

The library can also be used directly in your Python code:

```python
import asyncio
from chaturbate_poller import ChaturbateClient

async def main():
    async with ChaturbateClient("your_username", "your_token", testbed=False) as client:
        url = None
        while True:
            response = await client.fetch_events(url)
            for event in response.events:

                # Do something with the event
                print(event.model_dump())

            url = response.next_url

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

---

## Development

### Setup

1. Clone the repository:

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

2. Install dependencies using [uv](https://docs.astral.sh/uv/):

   ```bash
   uv sync --all-extras
   ```

### Running Tests

Run tests with `pytest`:

```bash
uv run pytest
```

### Documentation

Build and preview the documentation locally:

```bash
uv sync --extra=docs
uv run make clean html -C ./docs
```

---

## Contributing

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

1. Fork the repository.
2. Create a feature branch.
3. Submit a pull request, ensuring it includes tests and adheres to the coding standards.

---

## 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.11",
    "maintainer_email": null,
    "keywords": "api, chaturbate, poller, python",
    "author": null,
    "author_email": "MountainGod2 <admin@reid.ca>",
    "download_url": "https://files.pythonhosted.org/packages/97/90/c337adde801d65fdc6540d5d8cdcc9291a113a3d1bac15af03f32bb99dca/chaturbate_poller-1.8.3.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/docker-build.yml?branch=main&link=https%3A%2F%2Fgithub.com%2FMountainGod2%2Fchaturbate_poller%2Factions%2Fworkflows%2Fdocker-build.yml)](https://github.com/MountainGod2/chaturbate_poller/actions/workflows/docker-build.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 polling events from the Chaturbate API featuring asynchronous event handling, structured logging, and optional InfluxDB integration for analytics and monitoring.\n\n---\n\n## Features\n\n- **Event Polling**: Retrieve real-time events from the Chaturbate API.\n- **Error Handling**: Built-in retries, exponential backoff, and error classification.\n- **Logging**: Supports structured JSON logs and console outputs for better debugging.\n- **Optional InfluxDB Integration**: Store and analyze events using InfluxDB.\n\n---\n\n## Installation\n\nEnsure Python 3.11 or later is installed, then install the package via pip:\n\n```bash\npip install chaturbate-poller\n```\n\n### Environment Configuration (Optional)\n\nCreate a `.env` file in your project's root directory with the following:\n\n```text\nCB_USERNAME=\"your_chaturbate_username\"\nCB_TOKEN=\"your_chaturbate_token\"\nINFLUXDB_URL=\"http://influxdb:8086\"\nINFLUXDB_TOKEN=\"your_influxdb_token\"\nINFLUXDB_ORG=\"chaturbate-poller\"\nINFLUXDB_BUCKET=\"my-bucket\"\nUSE_DATABASE=\"false\"  # Set to `true` if InfluxDB is used\n```\n\n> \ud83d\udca1 **Tip**: [Generate an API token here](https://chaturbate.com/statsapi/authtoken/) with \"Events API\" permission enabled.\n\n---\n\n## Usage\n\n### CLI Usage\n\nStart the poller with the following command:\n\n```bash\npython -m chaturbate_poller start --username <your_username> --token <your_token>\n```\n\n#### Common CLI Options\n\n- `--username`: Your Chaturbate username. Defaults to `.env` file value.\n- `--token`: Your API token. Defaults to `.env` file value.\n- `--timeout`: Timeout for API requests (default: 10 seconds).\n- `--database`: Enable InfluxDB integration. Defaults to disabled.\n- `--testbed`: Enable the testbed environment for testing.\n- `--verbose`: Enable detailed logging for debugging.\n\nRun `python -m chaturbate_poller --help` for a complete list of options.\n\n### Docker\n\nTo run the poller in Docker, pull the image and start the container:\n\n```bash\ndocker pull ghcr.io/mountaingod2/chaturbate_poller:latest\ndocker run \\\n  -e CB_USERNAME=\"your_chaturbate_username\" \\\n  -e CB_TOKEN=\"your_chaturbate_token\" \\\n  ghcr.io/mountaingod2/chaturbate_poller:latest --verbose --database\n```\n\n---\n\n## Programmatic Usage\n\nThe library can also be used directly in your Python code:\n\n```python\nimport asyncio\nfrom chaturbate_poller import ChaturbateClient\n\nasync def main():\n    async with ChaturbateClient(\"your_username\", \"your_token\", testbed=False) as client:\n        url = None\n        while True:\n            response = await client.fetch_events(url)\n            for event in response.events:\n\n                # Do something with the event\n                print(event.model_dump())\n\n            url = response.next_url\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n---\n\n## Development\n\n### Setup\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 using [uv](https://docs.astral.sh/uv/):\n\n   ```bash\n   uv sync --all-extras\n   ```\n\n### Running Tests\n\nRun tests with `pytest`:\n\n```bash\nuv run pytest\n```\n\n### Documentation\n\nBuild and preview the documentation locally:\n\n```bash\nuv sync --extra=docs\nuv run make clean html -C ./docs\n```\n\n---\n\n## Contributing\n\nContributions are welcome! Here's how to get started:\n\n1. Fork the repository.\n2. Create a feature branch.\n3. Submit a pull request, ensuring it includes tests and adheres to the coding standards.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 MountainGod2\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Poller for the Chaturbate events API.",
    "version": "1.8.3",
    "project_urls": {
        "documentation": "https://mountaingod2.github.io/chaturbate_poller/",
        "homepage": "https://github.com/MountainGod2/chaturbate_poller",
        "repository": "https://github.com/MountainGod2/chaturbate_poller"
    },
    "split_keywords": [
        "api",
        " chaturbate",
        " poller",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ab75a4a1707ee2c2dd58989a8ab49bd6a5b0632afa99091b80538d9e9f26f96f",
                "md5": "832f82f191acc19b0c0e4553036847e5",
                "sha256": "99e3676a9ba1f7ab32582b98363adfdc39096960c1742e38d82ae5f46a2e3704"
            },
            "downloads": -1,
            "filename": "chaturbate_poller-1.8.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "832f82f191acc19b0c0e4553036847e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 21131,
            "upload_time": "2025-02-01T03:48:59",
            "upload_time_iso_8601": "2025-02-01T03:48:59.716407Z",
            "url": "https://files.pythonhosted.org/packages/ab/75/a4a1707ee2c2dd58989a8ab49bd6a5b0632afa99091b80538d9e9f26f96f/chaturbate_poller-1.8.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9790c337adde801d65fdc6540d5d8cdcc9291a113a3d1bac15af03f32bb99dca",
                "md5": "c56c1f03a2b2af0c51c30bcd61f4628e",
                "sha256": "4d95057157f083ca9ebda0cf63add187cda3c8a1b6b9823fb1ab98979e5dccf3"
            },
            "downloads": -1,
            "filename": "chaturbate_poller-1.8.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c56c1f03a2b2af0c51c30bcd61f4628e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 160817,
            "upload_time": "2025-02-01T03:49:02",
            "upload_time_iso_8601": "2025-02-01T03:49:02.122456Z",
            "url": "https://files.pythonhosted.org/packages/97/90/c337adde801d65fdc6540d5d8cdcc9291a113a3d1bac15af03f32bb99dca/chaturbate_poller-1.8.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-01 03:49:02",
    "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: 0.95819s