Metadata-Version: 2.4
Name: tmdbone
Version: 1.0.0
Summary: A resilient and comprehensive asynchronous TMDb API library with key rotation.
Project-URL: Homepage, https://github.com/onthejobtraining/tmdbone
Project-URL: Bug Tracker, https://github.com/onthejobtraining/tmdbone/issues
Author: onthejobtraining
License: MIT License
        
        Copyright (c) 2025 onthejobtraining
        
        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.
License-File: LICENSE
Keywords: api,asyncio,movie,resilient,tmdb,tv,wrapper
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Requires-Dist: aiohttp>=3.8.0
Description-Content-Type: text/markdown

# TMDbOne

[![PyPI version](https://badge.fury.io/py/tmdbone.svg)](https://pypi.org/project/tmdbone/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

TMDbOne is a powerful, asynchronous Python library for interacting with The Movie Database (TMDb) API.

## Features

- **Comprehensive:** Provides access to all data retrieval endpoints from the TMDb API v3.
- **Resilient:** Transparently handles API key rotation, automatic request retries, and rate-limit cooldowns.
- **Asynchronous:** Built from the ground up with `asyncio` and `aiohttp` for high-performance applications.
- **Modern:** A clean, chainable, object-oriented interface that mirrors the TMDb API's structure.

## Installation

```bash
pip install tmdbone
```

## Quick Start

```python
import asyncio
import os
from tmdbone import TMDbOneClient, TMDbAPIError

async def main():
    # Securely load keys from an environment variable (e.g., "key1,key2")
    api_keys_str = os.getenv("TMDB_API_KEYS")
    if not api_keys_str:
        raise ValueError("TMDB_API_KEYS environment variable is not set.")
    api_keys = [key.strip() for key in api_keys_str.split(',')]

    # Initialize the client with a global language
    client = TMDbOneClient(api_keys=api_keys, language="en-US")

    try:
        # Get details for the movie "Inception" (ID: 27205)
        inception = client.movie(27205)
        
        details = await inception.details()
        print(f"Title: {details['title']}")

        # Get external IDs (like IMDb ID)
        external_ids = await inception.external_ids()
        print(f"IMDb ID: {external_ids['imdb_id']}")

    except TMDbAPIError as e:
        print(f"An API error occurred: {e}")
    finally:
        await client.close()

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

## Advanced Usage

### Chaining for TV Shows

The interface allows for intuitive chaining to access nested resources.

```python
# Get details for Season 2, Episode 3 of "The Mandalorian"
episode_details = await client.tv(82856).season(2).episode(3).details()
print(episode_details['name'])
```

### Top-Level Endpoints

Access general API endpoints directly from the client.

```python
# Get a list of popular movies
popular_movies = await client.movies_popular(region="US")

# Get API configuration details
api_config = await client.configuration().api_details()
```