### Installing themoviedb (Full) via pip - Shell Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Installs the complete themoviedb library including dependencies for both synchronous (requests) and asynchronous (aiohttp) modes using pip. ```Shell pip install themoviedb[full] ``` -------------------------------- ### Installing themoviedb (Sync) via pip - Shell Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Installs only the synchronous version of the themoviedb library with its dependencies (requests) using pip. ```Shell pip install themoviedb[sync] ``` -------------------------------- ### Installing themoviedb (Async) via pip - Shell Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Installs only the asynchronous version of the themoviedb library with its dependencies (aiohttp) using pip. ```Shell pip install themoviedb[async] ``` -------------------------------- ### Fetching Popular TV Shows (Async) - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Demonstrates fetching popular TV shows using the asynchronous `aioTMDb` client within an `asyncio` event loop. Requires the themoviedb library installed with async support. ```Python import asyncio from themoviedb import aioTMDb async def main(): tmdb = aioTMDb() movies = await tmdb.tvs().popular() for movie in movies: print(movie) asyncio.run(main()) ``` -------------------------------- ### Fetching Top Rated Movies (Sync) - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Demonstrates how to fetch a list of top-rated movies using the synchronous `TMDb` client and iterate through the results. Requires the themoviedb library installed with sync support. ```Python from themoviedb import TMDb tmdb = TMDb() movies = tmdb.movies().top_rated() for movie in movies: print(movie) ``` -------------------------------- ### Searching and Fetching Movie Details (Async) - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Illustrates searching for a movie asynchronously and then fetching its detailed information, including credits, external IDs, images, and videos, using the `append_to_response` parameter. Requires async support installed. ```Python import asyncio from themoviedb import aioTMDb async def main(): tmdb = aioTMDb() movies = await tmdb.search().movies("fight club") movie_id = movies[0].id # get first result movie = await tmdb.movie(movie_id).details(append_to_response="credits,external_ids,images,videos") print(movie.title, movie.year) print(movie.tagline) print(movie.poster_url) print(movie.external_ids.imdb_url) for person in movie.credits.cast: print(person.name, person.character) asyncio.run(main()) ``` -------------------------------- ### Discovering Movies (Sync) - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Shows how to use the synchronous `TMDb` client's discover functionality to find movies based on criteria like sorting, release date, vote count, and vote average. Requires sync support installed. ```Python from themoviedb import TMDb tmdb = TMDb() movies = tmdb.discover().movie( sort_by="vote_average.desc", primary_release_date__gte="1997-08-15", vote_count__gte=10000, vote_average__gte=6.0, ) for movie in movies: print(movie) ``` -------------------------------- ### Initializing Client with Config - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Initializes a themoviedb client (`TMDb` for sync or `aioTMDb` for async) by passing the API key, language, and region directly to the constructor. ```Python tmdb = TMDb(key="YOUR_API_KEY", language="pt-BR", region="BR") # or: tmdb = aioTMDb(key="YOUR_API_KEY", language="pt-BR", region="BR") ``` -------------------------------- ### Initializing Client from Environment - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Initializes a themoviedb client (`TMDb` or `aioTMDb`) without parameters, allowing it to automatically load the API key, language, and region from environment variables if they are set. ```Python tmdb = TMDb() # from env: TMDB_KEY="YOUR_API_KEY", TMDB_LANGUAGE="pt-BR", TMDB_REGION="BR" # or: tmdb = aioTMDb() ``` -------------------------------- ### Configuring Client after Initialization - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Initializes a themoviedb client (`TMDb` or `aioTMDb`) and then sets the API key, language, and region properties after the object has been created. ```Python tmdb = TMDb() # or: tmdb = aioTMDb() tmdb.key = "YOUR_API_KEY" tmdb.language = "pt-BR" # default: en-US tmdb.region = "BR" # default: US ``` -------------------------------- ### Exporting Config via Environment Variables - Bash Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Sets The Movie Database API key, language, and region as environment variables (`TMDB_KEY`, `TMDB_LANGUAGE`, `TMDB_REGION`) which the themoviedb library can automatically load. ```Bash $ export TMDB_KEY="YOUR_API_KEY" $ export TMDB_LANGUAGE="pt-BR" # ISO 639-1 $ export TMDB_REGION="BR" # ISO-3166-1 ``` -------------------------------- ### Importing Async Client - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Imports the `aioTMDb` class, which is used to interact with The Movie Database API in asynchronous mode. This class provides awaitable methods for API calls. ```Python from themoviedb import aioTMDb ``` -------------------------------- ### Importing Sync Client - Python Source: https://github.com/leandcesar/themoviedb/blob/master/README.rst Imports the `TMDb` class, which is used to interact with The Movie Database API in synchronous mode. This class provides methods for accessing various API endpoints. ```Python from themoviedb import TMDb ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.