index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
1.07M
signature
stringlengths
2
42.8k
53,477
tmdbapis.objs.reload
_load
null
def _load(self, data, partial=False): super()._load(data, partial=partial) self._tv_shows = None self.alternative_names = self._parse(attrs=["alternative_names", "results"], value_type="alternative_name", is_list=True) self.country = self._parse(attrs="origin_country", value_type="country") self.headquarters = self._parse(attrs="headquarters") self.homepage = self._parse(attrs="homepage") self.id = self._parse(attrs="id", value_type="int") self.logo_path = self._parse(attrs="logo_path") self.logo_url = self._image_url(self.logo_path) self.logos = self._parse(attrs=["images", "logos"], value_type="logo", is_list=True) self.name = self._parse(attrs="name") self._finish(self.name)
(self, data, partial=False)
53,480
tmdbapis.exceptions
NotFound
Item not found.
class NotFound(TMDbException): """ Item not found. """ pass
null
53,481
tmdbapis.objs.reload
Person
Represents a single Person. Attributes: adult (bool): Is the Person an adult actor. also_known_as (List[str]): Name's this Person is also known as. biography (str): Person's Biography. birthday (datetime): Person's Birthday. deathday (datetime): Person's Deathday. facebook_id (str): Facebook ID for the Person. freebase_id (str): Freebase ID for the Person. freebase_mid (str): Freebase MID for the Person. gender (int): Person's Gender. (1: Women, 2: Men) homepage (str): Homepage for the Person. id (str): Person ID. imdb_id (str): IMDb ID for the Person. instagram_id (str): Instagram ID for the Person. known_for_department (str): Department the Person is best known for. name (str): Person's Name. place_of_birth (str): Person's Place of Birth. popularity (float): Person's Popularity. profile_path (str): Profile Path. profile_url (str): Profile Full URL. profiles (List[:class:`~tmdbapis.objs.image.Profile`]): List of other Profiles for the Person. movie_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Movie Cast Credits for the Person. movie_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Movie Crew Credits for the Person. tagged (class:`~tmdbapis.objs.pagination.TaggedImages`): Pagination Object of Tagged Images of this Person. translations (List[:class:`~tmdbapis.objs.simple.Translation`]): List of Translations for the Person. tv_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of TV Cast Credits for the Person. tv_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of TV Crew Credits for the Person. tvrage_id (str): TVRage ID for the Person. twitter_id (str): Twitter ID for the Person.
class Person(TMDbReload): """ Represents a single Person. Attributes: adult (bool): Is the Person an adult actor. also_known_as (List[str]): Name's this Person is also known as. biography (str): Person's Biography. birthday (datetime): Person's Birthday. deathday (datetime): Person's Deathday. facebook_id (str): Facebook ID for the Person. freebase_id (str): Freebase ID for the Person. freebase_mid (str): Freebase MID for the Person. gender (int): Person's Gender. (1: Women, 2: Men) homepage (str): Homepage for the Person. id (str): Person ID. imdb_id (str): IMDb ID for the Person. instagram_id (str): Instagram ID for the Person. known_for_department (str): Department the Person is best known for. name (str): Person's Name. place_of_birth (str): Person's Place of Birth. popularity (float): Person's Popularity. profile_path (str): Profile Path. profile_url (str): Profile Full URL. profiles (List[:class:`~tmdbapis.objs.image.Profile`]): List of other Profiles for the Person. movie_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Movie Cast Credits for the Person. movie_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Movie Crew Credits for the Person. tagged (class:`~tmdbapis.objs.pagination.TaggedImages`): Pagination Object of Tagged Images of this Person. translations (List[:class:`~tmdbapis.objs.simple.Translation`]): List of Translations for the Person. tv_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of TV Cast Credits for the Person. tv_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of TV Crew Credits for the Person. tvrage_id (str): TVRage ID for the Person. twitter_id (str): Twitter ID for the Person. """ def _load(self, data, partial=False): super()._load(data, partial=partial) self.adult = self._parse(attrs="adult", value_type="bool") self.also_known_as = self._parse(attrs="also_known_as", is_list=True) self.biography = self._parse(attrs="biography") self.birthday = self._parse(attrs="birthday", value_type="date") self.deathday = self._parse(attrs="deathday", value_type="date") self.facebook_id = self._parse(attrs=["external_ids", "facebook_id"]) self.freebase_id = self._parse(attrs=["external_ids", "freebase_id"]) self.freebase_mid = self._parse(attrs=["external_ids", "freebase_mid"]) self.gender = self._parse(attrs="gender", value_type="int") self.homepage = self._parse(attrs="homepage") self.id = self._parse(attrs="id", value_type="int") self.imdb_id = self._parse(attrs="imdb_id") self.instagram_id = self._parse(attrs=["external_ids", "instagram_id"]) self.known_for_department = self._parse(attrs="known_for_department") self.name = self._parse(attrs="name") self.place_of_birth = self._parse(attrs="place_of_birth") self.popularity = self._parse(attrs="popularity", value_type="float") self.profile_path = self._parse(attrs="profile_path") self.profile_url = self._image_url(self.profile_path) self.profiles = self._parse(attrs=["images", "profiles"], value_type="profile", is_list=True) self.movie_cast = self._parse(attrs=["movie_credits", "cast"], value_type="movie_cast", is_list=True) self.movie_crew = self._parse(attrs=["movie_credits", "crew"], value_type="movie_crew", is_list=True) self.tagged = self._parse(attrs="tagged_images", value_type="tagged_images", key=self.id) self.translations = self._parse(attrs=["translations", "translations"], value_type="translation", is_list=True) self.tv_cast = self._parse(attrs=["tv_credits", "cast"], value_type="tv_cast", is_list=True) self.tv_crew = self._parse(attrs=["tv_credits", "crew"], value_type="tv_crew", is_list=True) self.tvrage_id = self._parse(attrs=["external_ids", "tvrage_id"], value_type="int") self.twitter_id = self._parse(attrs=["external_ids", "twitter_id"]) self._finish(self.name) def _append_str(self): return "movie_credits,tv_credits,external_ids,images,tagged_images,translations" def _full_load(self, partial=None): return self._api.people_get_details(self.id, language=self._tmdb.language, append_to_response=partial)
(tmdb, data, load=False, partial=False)
53,490
tmdbapis.objs.reload
_append_str
null
def _append_str(self): return "movie_credits,tv_credits,external_ids,images,tagged_images,translations"
(self)
53,492
tmdbapis.objs.reload
_full_load
null
def _full_load(self, partial=None): return self._api.people_get_details(self.id, language=self._tmdb.language, append_to_response=partial)
(self, partial=None)
53,494
tmdbapis.objs.reload
_load
null
def _load(self, data, partial=False): super()._load(data, partial=partial) self.adult = self._parse(attrs="adult", value_type="bool") self.also_known_as = self._parse(attrs="also_known_as", is_list=True) self.biography = self._parse(attrs="biography") self.birthday = self._parse(attrs="birthday", value_type="date") self.deathday = self._parse(attrs="deathday", value_type="date") self.facebook_id = self._parse(attrs=["external_ids", "facebook_id"]) self.freebase_id = self._parse(attrs=["external_ids", "freebase_id"]) self.freebase_mid = self._parse(attrs=["external_ids", "freebase_mid"]) self.gender = self._parse(attrs="gender", value_type="int") self.homepage = self._parse(attrs="homepage") self.id = self._parse(attrs="id", value_type="int") self.imdb_id = self._parse(attrs="imdb_id") self.instagram_id = self._parse(attrs=["external_ids", "instagram_id"]) self.known_for_department = self._parse(attrs="known_for_department") self.name = self._parse(attrs="name") self.place_of_birth = self._parse(attrs="place_of_birth") self.popularity = self._parse(attrs="popularity", value_type="float") self.profile_path = self._parse(attrs="profile_path") self.profile_url = self._image_url(self.profile_path) self.profiles = self._parse(attrs=["images", "profiles"], value_type="profile", is_list=True) self.movie_cast = self._parse(attrs=["movie_credits", "cast"], value_type="movie_cast", is_list=True) self.movie_crew = self._parse(attrs=["movie_credits", "crew"], value_type="movie_crew", is_list=True) self.tagged = self._parse(attrs="tagged_images", value_type="tagged_images", key=self.id) self.translations = self._parse(attrs=["translations", "translations"], value_type="translation", is_list=True) self.tv_cast = self._parse(attrs=["tv_credits", "cast"], value_type="tv_cast", is_list=True) self.tv_crew = self._parse(attrs=["tv_credits", "crew"], value_type="tv_crew", is_list=True) self.tvrage_id = self._parse(attrs=["external_ids", "tvrage_id"], value_type="int") self.twitter_id = self._parse(attrs=["external_ids", "twitter_id"]) self._finish(self.name)
(self, data, partial=False)
53,497
tmdbapis.objs.image
Poster
Represents a single Poster Image.
class Poster(TMDbImage): """ Represents a single Poster Image. """ def __init__(self, tmdb, data): super().__init__(tmdb, data, "Poster")
(tmdb, data)
53,501
tmdbapis.objs.image
__init__
null
def __init__(self, tmdb, data): super().__init__(tmdb, data, "Poster")
(self, tmdb, data)
53,509
tmdbapis.objs.image
Profile
Represents a single Profile Image.
class Profile(TMDbImage): """ Represents a single Profile Image. """ def __init__(self, tmdb, data): super().__init__(tmdb, data, "Profile")
(tmdb, data)
53,513
tmdbapis.objs.image
__init__
null
def __init__(self, tmdb, data): super().__init__(tmdb, data, "Profile")
(self, tmdb, data)
53,521
tmdbapis.objs.simple
ReleaseDate
Represents a Movie's Release Date. Release dates support different types: 1. Premiere 2. Theatrical (limited) 3. Theatrical 4. Digital 5. Physical 6. TV Attributes: certification (str): Movie's Certification. iso_639_1 (str): ISO 639-1 Language Code of the Release Date. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. note (str): Note about the release date. release_date (datetime): Movie's release date. type (int): Type of release.
class ReleaseDate(TMDbObj): """ Represents a Movie's Release Date. Release dates support different types: 1. Premiere 2. Theatrical (limited) 3. Theatrical 4. Digital 5. Physical 6. TV Attributes: certification (str): Movie's Certification. iso_639_1 (str): ISO 639-1 Language Code of the Release Date. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. note (str): Note about the release date. release_date (datetime): Movie's release date. type (int): Type of release. """ def _load(self, data): super()._load(data) self.certification = self._parse(attrs="certification") self.iso_639_1 = self._parse(attrs="iso_639_1") self.language = self._tmdb._get_object(self._data, "language") self.note = self._parse(attrs="note") self.release_date = self._parse(attrs="release_date", value_type="date") self.type = self._parse(attrs="type", value_type="int") self._finish(self.release_date)
(tmdb: 'TMDbAPIs', data)
53,531
tmdbapis.objs.simple
_load
null
def _load(self, data): super()._load(data) self.certification = self._parse(attrs="certification") self.iso_639_1 = self._parse(attrs="iso_639_1") self.language = self._tmdb._get_object(self._data, "language") self.note = self._parse(attrs="note") self.release_date = self._parse(attrs="release_date", value_type="date") self.type = self._parse(attrs="type", value_type="int") self._finish(self.release_date)
(self, data)
53,533
tmdbapis.objs.reload
Review
Represents a single Review. Attributes: author (str): Review Author. avatar_path (str): Review Author Avatar Path. avatar_url (str): Review Author Avatar Full URL. content (str): Review content. created_at (datetime): Date Review was Created. id (str): Review ID. iso_639_1 (str): Default ISO 639-1 Language Code of the Review. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. media_id (int): Media ID of the Review. media_title (str): Media Title of the Review. media_type (str): Media Type of the Media ID. rating (float): Review Rating. updated_at (datetime): Date Review was Updated. url (str): Review URL. username (str): Review Author Username.
class Review(TMDbReload): """ Represents a single Review. Attributes: author (str): Review Author. avatar_path (str): Review Author Avatar Path. avatar_url (str): Review Author Avatar Full URL. content (str): Review content. created_at (datetime): Date Review was Created. id (str): Review ID. iso_639_1 (str): Default ISO 639-1 Language Code of the Review. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. media_id (int): Media ID of the Review. media_title (str): Media Title of the Review. media_type (str): Media Type of the Media ID. rating (float): Review Rating. updated_at (datetime): Date Review was Updated. url (str): Review URL. username (str): Review Author Username. """ def _load(self, data, partial=False): super()._load(data, partial=partial) self.author = self._parse(attrs="author") self.avatar_path = self._parse(attrs=["author_details", "avatar_path"]) self.avatar_url = self._image_url(self.avatar_path) self.content = self._parse(attrs="content") self.created_at = self._parse(attrs="created_at", value_type="date") self.id = self._parse(attrs="review_id" if "review_id" in self._data else "id") self.iso_639_1 = self._parse(attrs="iso_639_1") self.language = self._tmdb._get_object(self._data, "language") self.media_id = self._parse(attrs="media_id", value_type="int") self.media_title = self._parse(attrs="media_title") self.media_type = self._parse(attrs="media_type") self.rating = self._parse(attrs=["author_details", "rating"], value_type="float") self.updated_at = self._parse(attrs="updated_at", value_type="date") self.url = self._parse(attrs="url") self.username = self._parse(attrs=["author_details", "username"]) self._finish(self.author) def _full_load(self, partial=None): return self._api.reviews_get_details(self.id)
(tmdb, data, load=False, partial=False)
53,544
tmdbapis.objs.reload
_full_load
null
def _full_load(self, partial=None): return self._api.reviews_get_details(self.id)
(self, partial=None)
53,546
tmdbapis.objs.reload
_load
null
def _load(self, data, partial=False): super()._load(data, partial=partial) self.author = self._parse(attrs="author") self.avatar_path = self._parse(attrs=["author_details", "avatar_path"]) self.avatar_url = self._image_url(self.avatar_path) self.content = self._parse(attrs="content") self.created_at = self._parse(attrs="created_at", value_type="date") self.id = self._parse(attrs="review_id" if "review_id" in self._data else "id") self.iso_639_1 = self._parse(attrs="iso_639_1") self.language = self._tmdb._get_object(self._data, "language") self.media_id = self._parse(attrs="media_id", value_type="int") self.media_title = self._parse(attrs="media_title") self.media_type = self._parse(attrs="media_type") self.rating = self._parse(attrs=["author_details", "rating"], value_type="float") self.updated_at = self._parse(attrs="updated_at", value_type="date") self.url = self._parse(attrs="url") self.username = self._parse(attrs=["author_details", "username"]) self._finish(self.author)
(self, data, partial=False)
53,549
tmdbapis.objs.reload
Season
Represents a single Season. Attributes: aggregate_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Aggregate Crew Credits. aggregate_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Aggregate Crew Credits. air_date (datetime): Season Air Date. cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Cast Credits. crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Crew Credits. episodes (List[:class:`~tmdbapis.objs.reload.Episode`]): List of Episodes in the Season. freebase_id (str): Freebase ID for the Season. freebase_mid (str): Freebase MID for the Season. id (int): Season ID. name (str): Season Name. poster_path (str): Poster Path. poster_url (str): Poster Full URL. posters (List[:class:`~tmdbapis.objs.image.Poster`]): List of other Posters for the Season. overview (str): Season Overview. season_number (int): Season Number. title (str): alias of name. translations (List[:class:`~tmdbapis.objs.simple.Translation`]): List of Translations for the Season. tv_id (int): TMDb TV Show ID the contains the Season. tvdb_id (int): TVDB ID of the Season. tvrage_id (int): TV Rage ID of the Season. videos (List[:class:`~tmdbapis.objs.simple.Video`]): List of Videos associated with the Season. vote_average (float): Vote Average for the TV Season.
class Season(TMDbReload): """ Represents a single Season. Attributes: aggregate_cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Aggregate Crew Credits. aggregate_crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Aggregate Crew Credits. air_date (datetime): Season Air Date. cast (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Cast Credits. crew (List[:class:`~tmdbapis.objs.reload.Credit`]): List of Season Crew Credits. episodes (List[:class:`~tmdbapis.objs.reload.Episode`]): List of Episodes in the Season. freebase_id (str): Freebase ID for the Season. freebase_mid (str): Freebase MID for the Season. id (int): Season ID. name (str): Season Name. poster_path (str): Poster Path. poster_url (str): Poster Full URL. posters (List[:class:`~tmdbapis.objs.image.Poster`]): List of other Posters for the Season. overview (str): Season Overview. season_number (int): Season Number. title (str): alias of name. translations (List[:class:`~tmdbapis.objs.simple.Translation`]): List of Translations for the Season. tv_id (int): TMDb TV Show ID the contains the Season. tvdb_id (int): TVDB ID of the Season. tvrage_id (int): TV Rage ID of the Season. videos (List[:class:`~tmdbapis.objs.simple.Video`]): List of Videos associated with the Season. vote_average (float): Vote Average for the TV Season. """ def __init__(self, tmdb, data, tv_id, load=False, partial=False): self._tv_id = tv_id super().__init__(tmdb, data=data, load=load, partial=partial) def _load(self, data, partial=False): super()._load(data, partial=partial) self.aggregate_cast = self._parse(attrs=["aggregate_credits", "cast"], value_type="agg_tv_cast", extend=True) self.aggregate_crew = self._parse(attrs=["aggregate_credits", "crew"], value_type="agg_tv_crew", extend=True) self.air_date = self._parse(attrs="air_date", value_type="date") self.cast = self._parse(attrs=["credits", "cast"], value_type="tv_cast", is_list=True) self.crew = self._parse(attrs=["credits", "crew"], value_type="tv_crew", is_list=True) self.tv_id = self._parse(attrs="show_id", value_type="int") if "show_id" in self._data else self._tv_id self.episodes = self._parse(attrs="episodes", value_type="episode", is_list=True, key=self.tv_id) self.freebase_id = self._parse(attrs=["external_ids", "freebase_id"]) self.freebase_mid = self._parse(attrs=["external_ids", "freebase_mid"]) self.id = self._parse(attrs="id", value_type="int") self.name = self._parse(attrs="name") self.overview = self._parse(attrs="overview") self.poster_path = self._parse(attrs="poster_path") self.poster_url = self._image_url(self.poster_path) self.posters = self._parse(attrs=["images", "posters"], value_type="poster", is_list=True) self.season_number = self._parse(attrs="season_number", value_type="int") self.title = self.name self.translations = self._parse(attrs=["translations", "translations"], value_type="translation", is_list=True) self.tvdb_id = self._parse(attrs=["external_ids", "tvdb_id"], value_type="int") self.tvrage_id = self._parse(attrs=["external_ids", "tvrage_id"], value_type="int") self.videos = self._parse(attrs=["videos", "results"], value_type="video", is_list=True) self.vote_average = self._parse(attrs="vote_average", value_type="float") self._finish(self.name) def _append_str(self): return "images,external_ids,translations,aggregate_credits,credits" def _full_load(self, partial=None): return self._api.tv_seasons_get_details( self.tv_id, self.season_number, language=self._tmdb.language, include_image_language=self._tmdb._include_language, include_video_language=self._tmdb._include_language, append_to_response=partial )
(tmdb, data, tv_id, load=False, partial=False)
53,553
tmdbapis.objs.reload
__init__
null
def __init__(self, tmdb, data, tv_id, load=False, partial=False): self._tv_id = tv_id super().__init__(tmdb, data=data, load=load, partial=partial)
(self, tmdb, data, tv_id, load=False, partial=False)
53,558
tmdbapis.objs.reload
_append_str
null
def _append_str(self): return "images,external_ids,translations,aggregate_credits,credits"
(self)
53,560
tmdbapis.objs.reload
_full_load
null
def _full_load(self, partial=None): return self._api.tv_seasons_get_details( self.tv_id, self.season_number, language=self._tmdb.language, include_image_language=self._tmdb._include_language, include_video_language=self._tmdb._include_language, append_to_response=partial )
(self, partial=None)
53,562
tmdbapis.objs.reload
_load
null
def _load(self, data, partial=False): super()._load(data, partial=partial) self.aggregate_cast = self._parse(attrs=["aggregate_credits", "cast"], value_type="agg_tv_cast", extend=True) self.aggregate_crew = self._parse(attrs=["aggregate_credits", "crew"], value_type="agg_tv_crew", extend=True) self.air_date = self._parse(attrs="air_date", value_type="date") self.cast = self._parse(attrs=["credits", "cast"], value_type="tv_cast", is_list=True) self.crew = self._parse(attrs=["credits", "crew"], value_type="tv_crew", is_list=True) self.tv_id = self._parse(attrs="show_id", value_type="int") if "show_id" in self._data else self._tv_id self.episodes = self._parse(attrs="episodes", value_type="episode", is_list=True, key=self.tv_id) self.freebase_id = self._parse(attrs=["external_ids", "freebase_id"]) self.freebase_mid = self._parse(attrs=["external_ids", "freebase_mid"]) self.id = self._parse(attrs="id", value_type="int") self.name = self._parse(attrs="name") self.overview = self._parse(attrs="overview") self.poster_path = self._parse(attrs="poster_path") self.poster_url = self._image_url(self.poster_path) self.posters = self._parse(attrs=["images", "posters"], value_type="poster", is_list=True) self.season_number = self._parse(attrs="season_number", value_type="int") self.title = self.name self.translations = self._parse(attrs=["translations", "translations"], value_type="translation", is_list=True) self.tvdb_id = self._parse(attrs=["external_ids", "tvdb_id"], value_type="int") self.tvrage_id = self._parse(attrs=["external_ids", "tvrage_id"], value_type="int") self.videos = self._parse(attrs=["videos", "results"], value_type="video", is_list=True) self.vote_average = self._parse(attrs="vote_average", value_type="float") self._finish(self.name)
(self, data, partial=False)
53,565
tmdbapis.objs.image
Still
Represents a single Still Image.
class Still(TMDbImage): """ Represents a single Still Image. """ def __init__(self, tmdb, data): super().__init__(tmdb, data, "Still")
(tmdb, data)
53,569
tmdbapis.objs.image
__init__
null
def __init__(self, tmdb, data): super().__init__(tmdb, data, "Still")
(self, tmdb, data)
53,577
tmdbapis.tmdb
TMDbAPIs
Main Object Class Parameters: apikey (str): TMDb V3 API Key. session_id (Optional[str]): TMDb V3 Session ID. v4_access_token (Optional[str]): TMDb V4 Access Token. language (str): Default TMDb language. session (Optional[Session]): Use you're own Session object Attributes: language (str): TMDb Language. include_language (str): Comma-separated list of TMDb Languages to have included with images and videos. account_id (int): TMDb V3 Account ID. session_id (str): TMDb V3 Session ID. v4_account_id (str): TMDb V4 Account ID. v4_access_token (str): TMDb V4 Access Token.
class TMDbAPIs: """ Main Object Class Parameters: apikey (str): TMDb V3 API Key. session_id (Optional[str]): TMDb V3 Session ID. v4_access_token (Optional[str]): TMDb V4 Access Token. language (str): Default TMDb language. session (Optional[Session]): Use you're own Session object Attributes: language (str): TMDb Language. include_language (str): Comma-separated list of TMDb Languages to have included with images and videos. account_id (int): TMDb V3 Account ID. session_id (str): TMDb V3 Session ID. v4_account_id (str): TMDb V4 Account ID. v4_access_token (str): TMDb V4 Access Token. """ def __init__(self, apikey: str, session_id: Optional[str] = None, v4_access_token: Optional[str] = None, language=None, session: Optional[Session] = None): self._language = None self._session = Session() if session is None else session self._api4 = API4(v4_access_token, session=self._session) if v4_access_token else None self._api = API3(apikey, session_id=session_id, api4=self._api4, session=self._session, validate=False) self._request_token = None self._movie_certifications = None self._tv_certifications = None self._movie_genres = None self._movie_genre_lookups = None self._tv_genres = None self._tv_genre_lookups = None self._provider_regions = None self._movie_providers = None self._tv_providers = None self._config = None self._config = self.configuration() self._iso_3166_1 = {v.iso_3166_1.lower(): v for v in self._config.countries} self._iso_639_1 = {v.iso_639_1.lower(): v for v in self._config.languages} self._translations = {v.lower(): v for v in self._config.primary_translations} self._languages = [v for k, v in self._translations.items()] + [v.iso_639_1 for k, v in self._iso_639_1.items()] self._image_url = f"{self._config.secure_base_image_url}original" self.language = language self._include_language = None @property def _movie_genre_lookup(self): if self._movie_genre_lookups is None: self._movie_genre_lookups = {g.id: g for g in self.movie_genres()} return self._movie_genre_lookups @property def _tv_genre_lookup(self): if self._tv_genre_lookups is None: self._tv_genre_lookups = {g.id: g for g in self.tv_genres()} return self._tv_genre_lookups def _get_object(self, lookup, obj_type): def object_check(lookup_obj, key, lookup_dict, is_int=False): if isinstance(lookup_obj, dict): lookup_obj = lookup_obj[key] if key in lookup_obj else None lookup_obj = int(lookup_obj) if is_int else str(lookup_obj).lower() return lookup_dict[lookup_obj] if lookup_obj in lookup_dict else None if obj_type == "country": return object_check(lookup, "iso_3166_1", self._iso_3166_1) elif obj_type == "language": return object_check(lookup, "iso_639_1", self._iso_639_1) elif obj_type == "movie_genre": return object_check(lookup, "id", self._movie_genre_lookup, is_int=True) elif obj_type == "tv_genre": return object_check(lookup, "id", self._tv_genre_lookup, is_int=True) else: return None def _parse(self, data=None, attrs: Optional[Union[str, list]] = None, value_type: str = "str", default_is_none: bool = False, is_list: bool = False, is_dict: bool = False, extend: bool = False, key: Any = None): """ Validate the value given from the options given. Parameters: attrs (Optional[Union[str, list]]): check data for these attributes. value_type (str): Type that the value is. default_is_none (bool): Makes default None. is_list (bool): value is list of values. is_dict (bool): value is dict of values. extend (bool): value is list of values. key (Any): extra key. Returns: Any: Parsed Value """ if default_is_none is False and value_type in ["int", "float"]: default = 0 elif default_is_none is False and is_list: default = [] else: default = None value = data if attrs: if not isinstance(attrs, list): attrs = [attrs] for attr in attrs: if isinstance(value, dict) and attr in value: value = value[attr] else: return default if value is None: return default elif extend: export_list = [] for v in value: export_list.extend(self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=key)) return export_list elif is_list: return [self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=key) for v in value] elif is_dict: return {k: self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=k) for k, v in value.items()} elif value_type == "int": return int(value) elif value_type == "float": return float(value) elif value_type == "bool": if isinstance(value, bool): return value elif str(value).lower() in ["t", "true", "1", "y", "yes"]: return True elif str(value).lower() in ["f", "false", "0", "n", "no"]: return False else: return default elif value_type == "date": if not value: return None elif "T" in value: return datetime.strptime(value[:-1].split(".")[0], "%Y-%m-%dT%H:%M:%S") else: return datetime.strptime(value, "%Y-%m-%d") elif value_type == "dict": return value elif value_type == "alternative_name": return AlternativeName(self, value) elif value_type == "alternative_title": return AlternativeTitle(self, value) elif value_type == "certification": return Certification(self, value) elif value_type == "load_country": return Country(self, value) elif value_type == "country_certification": return CountryCertifications(self, value, key) elif value_type == "country_watch_provider": return CountryWatchProviders(self, value, key) elif value_type == "load_department": return Department(self, value) elif value_type == "load_genre": return Genre(self, value) elif value_type == "group": return Group(self, value) elif value_type == "load_language": return Language(self, value) elif value_type == "release_date": return ReleaseDate(self, value) elif value_type == "load_timezone": return Timezones(self, value) elif value_type == "trailer": return Trailer(self, value) elif value_type == "translation": return Translation(self, value) elif value_type == "user": return User(self, value) elif value_type == "video": return Video(self, value) elif value_type == "watch_provider": return WatchProvider(self, value) elif value_type == "backdrop": return Backdrop(self, value) elif value_type == "logo": return Logo(self, value) elif value_type == "poster": return Poster(self, value) elif value_type == "profile": return Profile(self, value) elif value_type == "still": return Still(self, value) elif value_type == "tagged": return Tagged(self, value) elif value_type == "collection": return Collection(self, value) elif value_type == "company": return Company(self, value) elif value_type == "movie_cast": return Credit(self, value, credit_type="cast", media_type="movie") elif value_type == "movie_crew": return Credit(self, value, credit_type="crew", media_type="movie") elif value_type == "tv_cast": return Credit(self, value, credit_type="cast", media_type="tv") elif value_type == "tv_crew": return Credit(self, value, credit_type="crew", media_type="tv") elif value_type == "agg_tv_cast": cast = [] for role in value["roles"]: new_dict = value.copy() for k, v in role.items(): new_dict[k] = v cast.append(Credit(self, new_dict, credit_type="cast", media_type="tv")) return cast elif value_type == "agg_tv_crew": crew = [] for role in value["jobs"]: new_dict = value.copy() for k, v in role.items(): new_dict[k] = v crew.append(Credit(self, new_dict, credit_type="crew", media_type="tv")) return crew elif value_type == "keyword": return Keyword(self, value) elif value_type == "movie": return Movie(self, value) elif value_type == "network": return Network(self, value) elif value_type == "person": return Person(self, value) elif value_type == "review": return Review(self, value) elif value_type == "tv": return TVShow(self, value) elif value_type == "season": return Season(self, value, key) elif value_type == "episode": return Episode(self, value, key) elif value_type == "episode_group": return EpisodeGroup(self, value, key) elif value_type == "media_type": if value["media_type"] == "movie": return Movie(self, value) elif value["media_type"] == "tv": return TVShow(self, value) elif value["media_type"] == "person": return Person(self, value) elif value_type == "list": return TMDbList(self, value) elif value_type == "movie_reviews": return MovieReviews(self, value, key) elif value_type == "lists": return MovieLists(self, value, key) elif value_type == "recommended_movies": return RecommendedMovies(self, value, key) elif value_type == "similar_movies": return SimilarMovies(self, value, key) elif value_type == "recommended_tv": return RecommendedTVShows(self, value, key) elif value_type == "similar_tv": return SimilarTVShows(self, value, key) elif value_type == "tagged_images": return TaggedImages(self, value, key) elif value_type == "content_rating": return {v["iso_3166_1"]: v["rating"] for v in value} elif value_type in ["country", "language", "movie_genre", "tv_genre"]: return self._get_object(value, value_type) else: return str(value) def _validate_language(self, language): if isinstance(language, Language): return language.iso_639_1 elif str(language).lower() in self._iso_639_1: return str(language).lower() else: raise Invalid(f"Language: {language} is invalid see Configuration.languages for the options.") def _validate_country(self, country): if not country: return None elif isinstance(country, Country): return country.iso_3166_1 elif str(country).lower() in self._iso_3166_1: return str(country).lower() else: raise Invalid(f"Country: {country} is invalid see Configuration.countries for the options.") def _validate_translation(self, translation): if str(translation).lower() in self._translations: return self._translations[str(translation).lower()] else: raise Invalid(f"Translation: {translation} is invalid see Configuration.primary_translations for the options.") def _validate_date(self, data, date_format="%Y-%m-%d"): if not data: return None elif isinstance(data, datetime): return data.strftime(date_format) else: try: return datetime.strptime(str(data), date_format).strftime(date_format) except ValueError: raise Invalid(f"date: {data} must be a datetime or in the format YYYY-MM-DD (e.g. 2020-12-25)") def _validate_discover(self, is_movie, **kwargs): validated = {} for k, v in kwargs.items(): if is_movie and k not in discover_movie_options or not is_movie and k not in discover_tv_options: raise Invalid(f"{k} is not a valid parameter") elif k == "sort_by": if is_movie and v not in discover_movie_sort_options or not is_movie and v not in discover_tv_sort_options: raise Invalid(f"{v} is not a valid sort_by option") validated[k] = v elif k in ["region"]: validated[k] = self._validate_country(v).upper() elif k == "certification_country": if "certification" not in kwargs and "certification.lte" not in kwargs and "certification.gte" not in kwargs: raise Invalid("certification_country must be used with either certification, certification.lte, or certification.gte") validated[k] = str(v) elif k in ["certification", "certification.lte", "certification.gte"]: if "certification_country" not in kwargs: raise Invalid("certification must be used with certification_country") validated[k] = str(v) elif k in ["include_adult", "include_video", "include_null_first_air_dates", "screened_theatrically"]: data = self._parse(data=v, value_type="bool") if data is None: raise Invalid(f"{k} must be either True or False") validated[k] = v elif k in ["primary_release_date.gte", "primary_release_date.lte", "release_date.gte", "release_date.lte", "air_date.gte", "air_date.lte", "first_air_date.gte", "first_air_date.lte"]: data = self._validate_date(v) if data: validated[k] = data elif k in ["primary_release_year", "first_air_date_year", "vote_count.gte", "vote_count.lte", "with_runtime.gte", "with_runtime.lte"]: if not isinstance(v, int) or v <= 0: raise Invalid(f"{k} must be an integer greater than 0") validated[k] = v elif k in ["vote_average.gte", "vote_average.lte"]: if not isinstance(v, (int, float)) or v <= 0: raise Invalid(f"{k} must be a number greater than 0.0") validated[k] = float(v) elif k == "with_watch_monetization_types": if v not in ["flatrate", "free", "ads", "rent", "buy"]: raise Invalid(f"{v} is not a valid with_watch_monetization_types option. Options: [flatrate, free, ads, rent, or buy]") if "watch_region" not in kwargs: raise Invalid("with_watch_monetization_types must be used with watch_region") validated[k] = v else: validated[k] = ",".join([str(x) for x in v]) if isinstance(v, list) else str(v) return validated @property def include_language(self): return self._include_language @include_language.setter def include_language(self, include_language): if include_language is None: self._include_language = None else: final = [] for lang in str(include_language).split(","): if str(lang).lower() in ["null", "none"]: final.append("null") elif str(lang).lower() in self._iso_639_1: final.append(str(lang).lower()) else: try: final.append(self._validate_translation(lang)) except Invalid: raise Invalid(f"Language: {lang} is invalid see Configuration.languages and Configuration.primary_translations for the options.") self._include_language = ",".join(final) @property def language(self): return self._language @language.setter def language(self, lang): if lang is None: self._language = None elif str(lang).lower() in self._iso_639_1: self._language = str(lang).lower() else: try: self._language = self._validate_translation(lang) except Invalid: raise Invalid(f"Language: {lang} is invalid see Configuration.languages and Configuration.primary_translations for the options.") @property def account_id(self): return self._api.account_id @property def session_id(self): return self._api.session_id @property def v4_account_id(self): return self._v4_check().account_id @property def v4_access_token(self): return self._v4_check().access_token def authenticate(self, username: str, password: str): """ Use this to authenticate the TMDb V3 Session. Parameters: username (str): TMDb Username. password (str): TMDb Password. """ request_token = self._api.authentication_create_request_token()["request_token"] self._api.authentication_create_session_with_login(username, password, request_token) self._api.authentication_create_session(request_token) def v4_access(self, access_token: str): """ Use this method to set up TMDb's V4 API To gain read access to TMDb V4's API just provide you're TMDb V4 Access Token either with this method or by using the ``v4_access_token`` Parameter of the :class:`~tmdbapis.tmdb.TMDbAPIs` constructor. To gain write access to TMDb V4's API 1. Gain Read Access 2. Authenticate the URL returned from :meth:`v4_authenticate`. 3. Approve the authentication using :meth:`v4_approved`. To get you're TMDb V3 Write Access Token use :attr:`TMDbAPIs.v4_access_token` After it's been approved. Parameters: access_token (str): TMDb V4 Access Token """ self._api4 = API4(access_token, session=self._session) self._api._api4 = self._api4 def _v4_check(self, write=False): if not self._api4: raise Authentication(f"Requires V4 API Read Access Token, use tmdbapis.v4_access(access_token)") if write and not self._api4.has_write_token: raise Authentication(f"Requires V4 API Write Access Token, use tmdbapis.v4_authenticate() and approve the returned URL then use tmdbapis.v4_approved()") return self._api4 def v4_authenticate(self): """ Use this method to get the authentication URL for write access to TMDb V4 API """ self._request_token = self._v4_check().auth_create_request_token()["request_token"] return f"https://www.themoviedb.org/auth/access?request_token={self._request_token}" def v4_approved(self): """ Use this method once the URL from :meth:`v4_authenticate` has been authenticated to gain write access to TMDb V4 API """ if not self._request_token: raise Authentication("Requires V4 Authentication, use tmdbapis.v4_authenticate() and approve the returned URL") self._v4_check().auth_create_access_token(self._request_token) def account(self): """ :class:`~tmdbapis.objs.reload.Account` Object with your account details. Returns: :class:`~tmdbapis.objs.reload.Account` Raises: :class:`~tmdbapis.exceptions.Authentication`: When you haven't authenticated a session yet. """ return Account(self) def created_lists(self, v3: bool = False): """ Paginated Object of all the lists created by an account. Will include private lists if you are the owner. Parameters: v3 (bool): Force List V3 Usage Returns: :class:`~tmdbapis.objs.pagination.CreatedLists` """ return CreatedLists(self, v3=v3) def favorite_movies(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return FavoriteMovies(self, sort_by=sort_by, v3=v3) def favorite_tv_shows(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return FavoriteTVShows(self, sort_by=sort_by, v3=v3) def rated_movies(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedMovies(self, sort_by=sort_by, v3=v3) def rated_tv_shows(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedTVShows(self, sort_by=sort_by, v3=v3) def rated_episodes(self, sort_by: Optional[str] = None): """ Paginated Object of TV episodes you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` Returns: :class:`~tmdbapis.objs.pagination.RatedEpisodes` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedEpisodes(self, sort_by=sort_by) def movie_watchlist(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.MovieWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return MovieWatchlist(self, sort_by=sort_by, v3=v3) def tv_show_watchlist(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.reload.TVShowWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return TVShowWatchlist(self, sort_by=sort_by, v3=v3) def movie_recommendations(self, sort_by: Optional[str] = None): """ Paginated Object of your personal movie recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` - ``release_date.desc`` * - ``title.asc`` - ``title.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.pagination.MovieRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return MovieRecommendations(self, sort_by=sort_by) def tv_show_recommendations(self, sort_by: Optional[str] = None): """ Paginated Object of your personal TV show recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` - ``first_air_date.desc`` * - ``name.asc`` - ``name.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.reload.TVShowRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return TVShowRecommendations(self, sort_by=sort_by) def logout(self): """ End all V3 and V4 Authenticated Sessions """ if self._api._session_id: self._api.authentication_delete_session(self._api._session_id) if self._api4: if self._api4.has_write_token: self._api4.auth_delete_access_token(self._api4.access_token) def movie_certifications(self, reload: bool = False) -> Dict[str, CountryCertifications]: """ Get an up to date list of the officially supported movie certifications on TMDB. Parameters: reload (bool): Reload the cached movie certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`] """ if reload or self._movie_certifications is None: self._movie_certifications = self._parse(data=self._api.certifications_get_movie_certifications(), attrs="certifications", value_type="country_certification", is_dict=True) return self._movie_certifications def tv_certifications(self, reload: bool = False) -> Dict[str, CountryCertifications]: """ Get an up to date list of the officially supported TV show certifications on TMDB. Parameters: reload (bool): Reload the cached tv certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`] """ if reload or self._tv_certifications is None: self._tv_certifications = self._parse(data=self._api.certifications_get_tv_certifications(), attrs="certifications", value_type="country_certification", is_dict=True) return self._tv_certifications def movie_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[Movie]: """ Get a list of :class:`~tmdbapis.objs.reload.Movie` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Movies at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.Movie`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [Movie(self, data) for data in self._api.changes_get_movie_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]] def tv_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[TVShow]: """ Get a list of :class:`~tmdbapis.objs.reload.TV` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Shows at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.TVShow`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [TVShow(self, data) for data in self._api.changes_get_tv_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]] def person_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[Person]: """ Get a list of :class:`~tmdbapis.objs.pagination.Person` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed People at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.pagination.Person`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [Person(self, data) for data in self._api.changes_get_person_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]] def collection(self, collection_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Collection: """ Gets the :class:`~tmdbapis.objs.reload.Collection` for the given id. Parameters: collection_id (int): Collection ID of the collection you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Collection` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no collection is found for the given id. """ return Collection(self, {"id": collection_id}, load=load, partial=partial) def company(self, company_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Company: """ Gets the :class:`~tmdbapis.objs.reload.Company` for the given id. Parameters: company_id (int): Company ID of the company you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Company` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no company is found for the given id. """ return Company(self, {"id": company_id}, load=load, partial=partial) def configuration(self, reload: bool = False) -> Configuration: """ Gets the TMDb :class:`~tmdbapis.objs.reload.Configuration`. Parameters: reload (bool): Reload the cached :class:`~tmdbapis.objs.reload.Configuration`. Returns: :class:`~tmdbapis.objs.reload.Configuration` """ if reload or self._config is None: self._config = Configuration(self) return self._config def credit(self, credit_id: str, load: bool = True) -> Credit: """ Gets the :class:`~tmdbapis.objs.reload.Credit` for the given id. Parameters: credit_id (str): Credit ID of the credit you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Credit` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no credit is found for the given id. """ return Credit(self, {"id": credit_id, "person": {}}, load=load) def discover_movies(self, **kwargs) -> DiscoverMovies: """ Discover movies by different types of data like average rating, number of votes, genres and certifications. You can get a valid list of certifications from the :meth:`movie_certifications` method. Discover also supports a nice list of sort options. See below for all of the available options. Please note, when using ``certification`` \\ ``certification.lte`` you must also specify ``certification_country``. These two parameters work together in order to filter the results. You can only filter results with the countries added to :meth:`movie_certifications`. If you specify the ``region`` parameter, the regional release date will be used instead of the primary release date. The date returned will be the first date based on your query (ie. if a ``with_release_type`` is specified). It's important to note the order of the release types that are used. Specifying "2|3" would return the limited theatrical release date as opposed to "3|2" which would return the theatrical date. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. region (Optional[str]): ISO-3166-1 code to filter release dates. Must be uppercase. sort_by (Optional[str]): Allowed Values: ``popularity.asc``, ``popularity.desc``, ``release_date.asc``, ``release_date.desc``, ``revenue.asc``, ``revenue.desc``, ``primary_release_date.asc``, ``primary_release_date.desc``, ``original_title.asc``, ``original_title.desc``, ``vote_average.asc``, ``vote_average.desc``, ``vote_count.asc``, ``vote_count.desc`` certification_country (Optional[str]): Used in conjunction with the ``certification`` filter, use this to specify a country with a valid certification. certification (Optional[str]): Filter results with a valid certification from the ``certification_country`` field. certification.lte (Optional[str]): Filter and only include movies that have a certification that is less than or equal to the specified value. certification.gte (Optional[str]): Filter and only include movies that have a certification that is greater than or equal to the specified value. include_adult (Optional[bool]): A filter and include or exclude adult movies. include_video (Optional[bool]): A filter to include or exclude videos. page (Optional[int]): Specify the page of results to query. primary_release_year (Optional[int): A filter to limit the results to a specific primary release year. primary_release_date.gte (Optional[str]): Filter and only include movies that have a primary release date that is greater or equal to the specified value. Format: YYYY-MM-DD primary_release_date.lte (Optional[str]): Filter and only include movies that have a primary release date that is less than or equal to the specified value. Format: YYYY-MM-DD release_date.gte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is greater or equal to the specified value. Format: YYYY-MM-DD release_date.lte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is less than or equal to the specified value. Format: YYYY-MM-DD with_release_type (Optional[int]): Specify a comma (AND) or pipe (OR) separated value to filter release types by. These release types map to the same values found on the movie release date method. year (Optional[int]): A filter to limit the results to a specific year (looking at all release dates). vote_count.gte (Optional[int]): Filter and only include movies that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include movies that have a vote count that is less than or equal to the specified value. vote_average.gte (Optional[float]): Filter and only include movies that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include movies that have a rating that is less than or equal to the specified value. with_cast (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as an actor. with_crew (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a crew member. with_people (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a either a actor or a crew member. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes movies that have one of the ID's added as a keyword. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. with_runtime.gte (Optional[int]): Filter and only include movies that have a runtime that is greater or equal to a value. with_runtime.lte (Optional[int]): Filter and only include movies that have a runtime that is less than or equal to a value. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. with_title_translation (Optional[str]): Specify a Primary Translation string to filter results by their title translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid. """ return DiscoverMovies(self, **self._validate_discover(True, **kwargs)) def discover_tv_shows(self, **kwargs) -> DiscoverTVShows: """ Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. Discover also supports a nice list of sort options. See below for all of the available options. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. sort_by (Optional[str]): Allowed Values: ``vote_average.desc``, ``vote_average.asc``, ``first_air_date.desc``, ``first_air_date.asc``, ``popularity.desc``, ``popularity.asc`` air_date.gte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is greater or equal to the specified value. Format: YYYY-MM-DD air_date.lte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is less than or equal to the specified value. Format: YYYY-MM-DD first_air_date.gte (Optional[str]): Filter and only include TV shows that have a original air date that is greater or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date.lte (Optional[str]): Filter and only include TV shows that have a original air date that is less than or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date_year (Optional[int]): Filter and only include TV shows that have a original air date year that equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. page (Optional[int]): Specify the page of results to query. timezone (Optional[str]): Used in conjunction with the ``air_date.gte``/``air_date.lte`` filter to calculate the proper UTC offset. vote_average.gte (Optional[float]): Filter and only include TV shows that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include TV shows that have a rating that is less than or equal to the specified value. vote_count.gte (Optional[int]): Filter and only include TV shows that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include TV shows that have a vote count that is less than or equal to the specified value. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. with_networks (Optional[str]): Comma separated value of network ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_runtime.gte (Optional[int]): Filter and only include TV shows with an episode runtime that is greater than or equal to a value. with_runtime.lte (Optional[int]): Filter and only include TV shows with an episode runtime that is less than or equal to a value. include_null_first_air_dates (Optional[bool]): Use this filter to include TV shows that don't have an air date while using any of the ``first_air_date`` filters. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. screened_theatrically (Optional[bool]): Filter results to include items that have been screened theatrically. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes TV shows that have one of the ID's added as a keyword. with_name_translation (Optional[str]): Specify a Primary Translation string to filter results by their name translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid. """ return DiscoverTVShows(self, **self._validate_discover(False, **kwargs)) def find_by_id(self, imdb_id: Optional[str] = None, freebase_mid: Optional[str] = None, freebase_id: Optional[str] = None, tvdb_id: Optional[str] = None, tvrage_id: Optional[str] = None, facebook_id: Optional[str] = None, twitter_id: Optional[str] = None, instagram_id: Optional[str] = None) -> FindResults: """ Gets the :class:`~tmdbapis.objs.simple.FindResults` for the given external id. Parameters: imdb_id (str): IMDb ID to find. freebase_mid (str): Freebase MID to find. freebase_id (str): Freebase ID to find. tvdb_id (str): TVDb ID to find. tvrage_id (str): TVRage ID to find. facebook_id (str): Facebook ID to find. twitter_id (str): Twitter ID to find. instagram_id (str): Instagram ID to find. Returns: :class:`~tmdbapis.objs.simple.FindResults` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are returned. :class:`~tmdbapis.exceptions.Invalid`: When no external id is given. """ if imdb_id: return FindResults(self, imdb_id, "imdb_id") elif freebase_mid: return FindResults(self, freebase_mid, "freebase_mid") elif freebase_id: return FindResults(self, freebase_id, "freebase_id") elif tvdb_id: return FindResults(self, tvdb_id, "tvdb_id") elif tvrage_id: return FindResults(self, tvrage_id, "tvrage_id") elif facebook_id: return FindResults(self, facebook_id, "facebook_id") elif twitter_id: return FindResults(self, twitter_id, "twitter_id") elif instagram_id: return FindResults(self, instagram_id, "instagram_id") else: raise Invalid("At least one ID is required") def movie_genres(self, reload: bool = False) -> List[Genre]: """ Gets a list of all movie :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`] """ if reload or self._movie_genres is None: self._movie_genres = self._parse(data=self._api.genres_get_movie_list(), attrs="genres", value_type="load_genre", is_list=True) return self._movie_genres def tv_genres(self, reload: bool = False) -> List[Genre]: """ Gets a list of all TV show :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`] """ if reload or self._tv_genres is None: self._tv_genres = self._parse(data=self._api.genres_get_tv_list(), attrs="genres", value_type="load_genre", is_list=True) return self._tv_genres def keyword(self, keyword_id: int, load: bool = True) -> Keyword: """ Gets the :class:`~tmdbapis.objs.reload.Keyword` for the given id. Parameters: keyword_id (int): Keyword ID of the keyword you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Keyword` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Keyword(self, {"id": keyword_id}, load=load) def list(self, list_id: int, load: bool = True) -> TMDbList: """ Gets the :class:`~tmdbapis.objs.pagination.TMDbList` for the given id. Parameters: list_id (str): Keyword ID of the list you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.pagination.TMDbList` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no list is found for the given id. """ return TMDbList(self, {"id": list_id}, load=load) def create_list(self, name: str, iso_639_1: Union[Language, str], description: Optional[str] = "", public: bool = True, iso_3166_1: Optional[Union[Country, str]] = None, load: bool = True) -> Union[TMDbList, int]: """ Creates a new List on TMDb and returns either a :class:`~tmdbapis.objs.pagination.TMDbList` Object or the List ID. Parameters: name (str): Name of the List. iso_639_1 (Union[Language, str]): ISO 639-1 Language Code of the List or :class:`tmdbapis.objs.simple.Language` Object. description (Optional[str]): Description of the List. public (bool): Determine if the list is a public list. (V4 Lists Only) iso_3166_1 (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code of the List or :class:`tmdbapis.objs.simple.Country` Object. (V4 Lists Only) load (bool): Load the list to return after creating it or just return the created List ID. Returns: Union[:class:`~tmdbapis.objs.pagination.TMDbList`, int] """ if self._api4 and self._api4.has_write_token: list_id = self._v4_check(write=True).list_create_list( name, self._validate_language(iso_639_1), description=description, public=public, iso_3166_1=self._validate_country(iso_3166_1) )["id"] else: list_id = self._api.lists_create_list( name=name, description=description, language=self._validate_language(iso_639_1) )["list_id"] return self.list(list_id) if load else int(list_id) def movie(self, movie_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Movie: """ Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: movie_id (str): Movie ID of the movie you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Movie` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Movie(self, {"id": movie_id}, load=load, partial=partial) def latest_movie(self) -> Movie: """ Gets the latest :class:`~tmdbapis.objs.reload.Movie` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Movie` """ return Movie(self, self._api.movies_get_latest(language=self.language)) def now_playing_movies(self, region: Optional[Union[Country, str]] = None) -> NowPlayingMovies: """ Paginated Object of Movies Now playing in theaters. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.NowPlayingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return NowPlayingMovies(self, region=self._validate_country(region)) def popular_movies(self, region: Optional[Union[Country, str]] = None) -> PopularMovies: """ Paginated Object of Popular Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.PopularMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return PopularMovies(self, region=self._validate_country(region)) def top_rated_movies(self, region: Optional[Union[Country, str]] = None) -> TopRatedMovies: """ Paginated Object of the Top Rated Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.TopRatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return TopRatedMovies(self, region=self._validate_country(region)) def upcoming_movies(self, region: Optional[Union[Country, str]] = None) -> UpcomingMovies: """ Paginated Object of Upcoming Movies. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.UpcomingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return UpcomingMovies(self, region=self._validate_country(region)) def network(self, network_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Network: """ Gets the :class:`~tmdbapis.objs.reload.Network` for the given id. Parameters: network_id (int): Network ID of the network you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Network` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no network is found for the given id. """ return Network(self, {"id": network_id}, load=load, partial=partial) def trending(self, media_type: str, time_window: str) -> Trending: """ Gets the :class:`~tmdbapis.objs.pagination.Trending` for the given id. Parameters: media_type (str): Trending media type. Allowed Values: ``all``, ``movie``, ``tv``, and ``person`` time_window (str): Trending list time window. Allowed Values: ``day`` and ``week`` Returns: :class:`~tmdbapis.objs.pagination.Trending` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``media_type`` or ``time_window`` is given an invalid option. """ if media_type not in ["all", "movie", "tv", "person"]: raise Invalid(f"media_type: {media_type} Invalid. Options: all, movie, tv, or person") if time_window not in ["day", "week"]: raise Invalid(f"time_window: {time_window} Invalid. Options: day or week") return Trending(self, media_type, time_window) def person(self, person_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Person: """ Gets the :class:`~tmdbapis.objs.reload.Person` for the given id. Parameters: person_id (int): Person ID of the person you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Person` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no person is found for the given id. """ return Person(self, {"id": person_id}, load=load, partial=partial) def latest_person(self) -> Person: """ Gets the latest :class:`~tmdbapis.objs.reload.Person` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Person` """ return Person(self, self._api.people_get_latest(language=self.language)) def popular_people(self) -> PopularPeople: """ Paginated Object of Popular People on TMDb. Returns: :class:`~tmdbapis.objs.pagination.PopularPeople` """ return PopularPeople(self) def review(self, review_id: str, load: bool = True) -> Review: """ Gets the :class:`~tmdbapis.objs.reload.Review` for the given id. Parameters: review_id (str): Review ID of the review you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Review` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no review is found for the given id. """ return Review(self, {"id": review_id}, load=load) def company_search(self, query: str) -> SearchCompanies: """ Searches TMDb for companies. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCompanies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchCompanies(self, query) def collection_search(self, query: str) -> SearchCollections: """ Searches TMDb for collections. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCollections` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchCollections(self, query) def keyword_search(self, query: str) -> SearchKeywords: """ Searches TMDb for keywords. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchKeywords` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchKeywords(self, query) def movie_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None, year: Optional[int] = None, primary_release_year: Optional[int] = None) -> SearchMovies: """ Searches TMDb for movies. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. year (Optional[int]): Specify a year for the search. primary_release_year (Optional[int]): Specify a primary release year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchMovies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchMovies(self, query, include_adult=include_adult, region=self._validate_country(region), year=year, primary_release_year=primary_release_year) def multi_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None) -> SearchMulti: """ Searches TMDb for movies, tv shows, and people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchMulti` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchMulti(self, query, include_adult=include_adult, region=self._validate_country(region)) def people_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None) -> SearchPeople: """ Searches TMDb for people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchPeople` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchPeople(self, query, include_adult=include_adult, region=self._validate_country(region)) def tv_search(self, query: str, include_adult: Optional[bool] = None, first_air_date_year: Optional[int] = None) -> SearchTVShows: """ Searches TMDb for tv shows. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. first_air_date_year (Optional[int]): Specify a first air date year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchTVShows` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchTVShows(self, query, include_adult=include_adult, first_air_date_year=first_air_date_year) def tv_show(self, tv_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> TVShow: """ Gets the :class:`~tmdbapis.objs.reload.TVShow` for the given id. Parameters: tv_id (int): TV ID of the show you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.TVShow` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return TVShow(self, {"id": tv_id}, load=load, partial=partial) def latest_tv(self) -> TVShow: """ Gets the latest :class:`~tmdbapis.objs.reload.TVShow` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.TVShow` """ return TVShow(self, self._api.tv_get_latest(language=self.language)) def tv_airing_today(self) -> TVShowsAiringToday: """ Paginated Object of TV Shows Airing Today. Returns: :class:`~tmdbapis.objs.reload.TVShowsAiringToday` """ return TVShowsAiringToday(self) def tv_on_the_air(self) -> TVShowsOnTheAir: """ Paginated Object of TV Shows On the Air. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir` """ return TVShowsOnTheAir(self) def popular_tv(self) -> PopularTVShows: """ Paginated Object of Popular TV Shows. Returns: :class:`~tmdbapis.objs.pagination.PopularTVShows` """ return PopularTVShows(self) def top_rated_tv(self) -> TopRatedTVShows: """ Paginated Object of Top Rated TV Shows On. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir` """ return TopRatedTVShows(self) def tv_season(self, tv_id: int, season_number: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Season: """ Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Season` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no season is found for the given id. """ return Season(self, {"season_number": season_number}, tv_id, load=load, partial=partial) def tv_episode(self, tv_id: int, season_number: int, episode_number: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Episode: """ Gets the :class:`~tmdbapis.objs.reload.Episode` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. episode_number (int): Episode number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Episode` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Episode(self, {"season_number": season_number, "episode_number": episode_number}, tv_id, load=load, partial=partial) def episode_group(self, episode_group_id: str, load: bool = True) -> EpisodeGroup: """ Gets the :class:`~tmdbapis.objs.reload.EpisodeGroup` for the given id. Parameters: episode_group_id (str): Episode Group ID that you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.EpisodeGroup` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return EpisodeGroup(self, {"id": episode_group_id}, load=load) def provider_regions(self, reload: bool = False) -> List[Country]: """ Gets a List of :class:`~tmdbapis.objs.simple.Country`. Parameters: reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]` """ if reload or self._provider_regions is None: self._provider_regions = [ Country(self, c) for c in self._api.watch_providers_get_available_regions(self.language) ] return self._provider_regions def movie_providers(self, watch_region: Optional[Union[Country, str]] = None, reload: bool = False) -> List[WatchProvider]: """ Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for movies. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[WatchProvider]` """ if reload or self._movie_providers is None: self._movie_providers = [ WatchProvider(self, w) for w in self._api.watch_providers_get_movie_providers(self.language, watch_region=watch_region)["results"] ] return self._movie_providers def tv_providers(self, watch_region: Optional[Union[Country, str]] = None, reload: bool = False) -> List[WatchProvider]: """ Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for shows. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]` """ if reload or self._tv_providers is None: self._tv_providers = [ WatchProvider(self, w) for w in self._api.watch_providers_get_tv_providers(self.language, watch_region=watch_region)["results"] ] return self._tv_providers
(apikey: str, session_id: Optional[str] = None, v4_access_token: Optional[str] = None, language=None, session: Optional[requests.sessions.Session] = None)
53,578
tmdbapis.tmdb
__init__
null
def __init__(self, apikey: str, session_id: Optional[str] = None, v4_access_token: Optional[str] = None, language=None, session: Optional[Session] = None): self._language = None self._session = Session() if session is None else session self._api4 = API4(v4_access_token, session=self._session) if v4_access_token else None self._api = API3(apikey, session_id=session_id, api4=self._api4, session=self._session, validate=False) self._request_token = None self._movie_certifications = None self._tv_certifications = None self._movie_genres = None self._movie_genre_lookups = None self._tv_genres = None self._tv_genre_lookups = None self._provider_regions = None self._movie_providers = None self._tv_providers = None self._config = None self._config = self.configuration() self._iso_3166_1 = {v.iso_3166_1.lower(): v for v in self._config.countries} self._iso_639_1 = {v.iso_639_1.lower(): v for v in self._config.languages} self._translations = {v.lower(): v for v in self._config.primary_translations} self._languages = [v for k, v in self._translations.items()] + [v.iso_639_1 for k, v in self._iso_639_1.items()] self._image_url = f"{self._config.secure_base_image_url}original" self.language = language self._include_language = None
(self, apikey: str, session_id: Optional[str] = None, v4_access_token: Optional[str] = None, language=None, session: Optional[requests.sessions.Session] = None)
53,579
tmdbapis.tmdb
_get_object
null
def _get_object(self, lookup, obj_type): def object_check(lookup_obj, key, lookup_dict, is_int=False): if isinstance(lookup_obj, dict): lookup_obj = lookup_obj[key] if key in lookup_obj else None lookup_obj = int(lookup_obj) if is_int else str(lookup_obj).lower() return lookup_dict[lookup_obj] if lookup_obj in lookup_dict else None if obj_type == "country": return object_check(lookup, "iso_3166_1", self._iso_3166_1) elif obj_type == "language": return object_check(lookup, "iso_639_1", self._iso_639_1) elif obj_type == "movie_genre": return object_check(lookup, "id", self._movie_genre_lookup, is_int=True) elif obj_type == "tv_genre": return object_check(lookup, "id", self._tv_genre_lookup, is_int=True) else: return None
(self, lookup, obj_type)
53,580
tmdbapis.tmdb
_parse
Validate the value given from the options given. Parameters: attrs (Optional[Union[str, list]]): check data for these attributes. value_type (str): Type that the value is. default_is_none (bool): Makes default None. is_list (bool): value is list of values. is_dict (bool): value is dict of values. extend (bool): value is list of values. key (Any): extra key. Returns: Any: Parsed Value
def _parse(self, data=None, attrs: Optional[Union[str, list]] = None, value_type: str = "str", default_is_none: bool = False, is_list: bool = False, is_dict: bool = False, extend: bool = False, key: Any = None): """ Validate the value given from the options given. Parameters: attrs (Optional[Union[str, list]]): check data for these attributes. value_type (str): Type that the value is. default_is_none (bool): Makes default None. is_list (bool): value is list of values. is_dict (bool): value is dict of values. extend (bool): value is list of values. key (Any): extra key. Returns: Any: Parsed Value """ if default_is_none is False and value_type in ["int", "float"]: default = 0 elif default_is_none is False and is_list: default = [] else: default = None value = data if attrs: if not isinstance(attrs, list): attrs = [attrs] for attr in attrs: if isinstance(value, dict) and attr in value: value = value[attr] else: return default if value is None: return default elif extend: export_list = [] for v in value: export_list.extend(self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=key)) return export_list elif is_list: return [self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=key) for v in value] elif is_dict: return {k: self._parse(data=v, value_type=value_type, default_is_none=default_is_none, key=k) for k, v in value.items()} elif value_type == "int": return int(value) elif value_type == "float": return float(value) elif value_type == "bool": if isinstance(value, bool): return value elif str(value).lower() in ["t", "true", "1", "y", "yes"]: return True elif str(value).lower() in ["f", "false", "0", "n", "no"]: return False else: return default elif value_type == "date": if not value: return None elif "T" in value: return datetime.strptime(value[:-1].split(".")[0], "%Y-%m-%dT%H:%M:%S") else: return datetime.strptime(value, "%Y-%m-%d") elif value_type == "dict": return value elif value_type == "alternative_name": return AlternativeName(self, value) elif value_type == "alternative_title": return AlternativeTitle(self, value) elif value_type == "certification": return Certification(self, value) elif value_type == "load_country": return Country(self, value) elif value_type == "country_certification": return CountryCertifications(self, value, key) elif value_type == "country_watch_provider": return CountryWatchProviders(self, value, key) elif value_type == "load_department": return Department(self, value) elif value_type == "load_genre": return Genre(self, value) elif value_type == "group": return Group(self, value) elif value_type == "load_language": return Language(self, value) elif value_type == "release_date": return ReleaseDate(self, value) elif value_type == "load_timezone": return Timezones(self, value) elif value_type == "trailer": return Trailer(self, value) elif value_type == "translation": return Translation(self, value) elif value_type == "user": return User(self, value) elif value_type == "video": return Video(self, value) elif value_type == "watch_provider": return WatchProvider(self, value) elif value_type == "backdrop": return Backdrop(self, value) elif value_type == "logo": return Logo(self, value) elif value_type == "poster": return Poster(self, value) elif value_type == "profile": return Profile(self, value) elif value_type == "still": return Still(self, value) elif value_type == "tagged": return Tagged(self, value) elif value_type == "collection": return Collection(self, value) elif value_type == "company": return Company(self, value) elif value_type == "movie_cast": return Credit(self, value, credit_type="cast", media_type="movie") elif value_type == "movie_crew": return Credit(self, value, credit_type="crew", media_type="movie") elif value_type == "tv_cast": return Credit(self, value, credit_type="cast", media_type="tv") elif value_type == "tv_crew": return Credit(self, value, credit_type="crew", media_type="tv") elif value_type == "agg_tv_cast": cast = [] for role in value["roles"]: new_dict = value.copy() for k, v in role.items(): new_dict[k] = v cast.append(Credit(self, new_dict, credit_type="cast", media_type="tv")) return cast elif value_type == "agg_tv_crew": crew = [] for role in value["jobs"]: new_dict = value.copy() for k, v in role.items(): new_dict[k] = v crew.append(Credit(self, new_dict, credit_type="crew", media_type="tv")) return crew elif value_type == "keyword": return Keyword(self, value) elif value_type == "movie": return Movie(self, value) elif value_type == "network": return Network(self, value) elif value_type == "person": return Person(self, value) elif value_type == "review": return Review(self, value) elif value_type == "tv": return TVShow(self, value) elif value_type == "season": return Season(self, value, key) elif value_type == "episode": return Episode(self, value, key) elif value_type == "episode_group": return EpisodeGroup(self, value, key) elif value_type == "media_type": if value["media_type"] == "movie": return Movie(self, value) elif value["media_type"] == "tv": return TVShow(self, value) elif value["media_type"] == "person": return Person(self, value) elif value_type == "list": return TMDbList(self, value) elif value_type == "movie_reviews": return MovieReviews(self, value, key) elif value_type == "lists": return MovieLists(self, value, key) elif value_type == "recommended_movies": return RecommendedMovies(self, value, key) elif value_type == "similar_movies": return SimilarMovies(self, value, key) elif value_type == "recommended_tv": return RecommendedTVShows(self, value, key) elif value_type == "similar_tv": return SimilarTVShows(self, value, key) elif value_type == "tagged_images": return TaggedImages(self, value, key) elif value_type == "content_rating": return {v["iso_3166_1"]: v["rating"] for v in value} elif value_type in ["country", "language", "movie_genre", "tv_genre"]: return self._get_object(value, value_type) else: return str(value)
(self, data=None, attrs: Union[str, list, NoneType] = None, value_type: str = 'str', default_is_none: bool = False, is_list: bool = False, is_dict: bool = False, extend: bool = False, key: Optional[Any] = None)
53,581
tmdbapis.tmdb
_v4_check
null
def _v4_check(self, write=False): if not self._api4: raise Authentication(f"Requires V4 API Read Access Token, use tmdbapis.v4_access(access_token)") if write and not self._api4.has_write_token: raise Authentication(f"Requires V4 API Write Access Token, use tmdbapis.v4_authenticate() and approve the returned URL then use tmdbapis.v4_approved()") return self._api4
(self, write=False)
53,582
tmdbapis.tmdb
_validate_country
null
def _validate_country(self, country): if not country: return None elif isinstance(country, Country): return country.iso_3166_1 elif str(country).lower() in self._iso_3166_1: return str(country).lower() else: raise Invalid(f"Country: {country} is invalid see Configuration.countries for the options.")
(self, country)
53,583
tmdbapis.tmdb
_validate_date
null
def _validate_date(self, data, date_format="%Y-%m-%d"): if not data: return None elif isinstance(data, datetime): return data.strftime(date_format) else: try: return datetime.strptime(str(data), date_format).strftime(date_format) except ValueError: raise Invalid(f"date: {data} must be a datetime or in the format YYYY-MM-DD (e.g. 2020-12-25)")
(self, data, date_format='%Y-%m-%d')
53,584
tmdbapis.tmdb
_validate_discover
null
def _validate_discover(self, is_movie, **kwargs): validated = {} for k, v in kwargs.items(): if is_movie and k not in discover_movie_options or not is_movie and k not in discover_tv_options: raise Invalid(f"{k} is not a valid parameter") elif k == "sort_by": if is_movie and v not in discover_movie_sort_options or not is_movie and v not in discover_tv_sort_options: raise Invalid(f"{v} is not a valid sort_by option") validated[k] = v elif k in ["region"]: validated[k] = self._validate_country(v).upper() elif k == "certification_country": if "certification" not in kwargs and "certification.lte" not in kwargs and "certification.gte" not in kwargs: raise Invalid("certification_country must be used with either certification, certification.lte, or certification.gte") validated[k] = str(v) elif k in ["certification", "certification.lte", "certification.gte"]: if "certification_country" not in kwargs: raise Invalid("certification must be used with certification_country") validated[k] = str(v) elif k in ["include_adult", "include_video", "include_null_first_air_dates", "screened_theatrically"]: data = self._parse(data=v, value_type="bool") if data is None: raise Invalid(f"{k} must be either True or False") validated[k] = v elif k in ["primary_release_date.gte", "primary_release_date.lte", "release_date.gte", "release_date.lte", "air_date.gte", "air_date.lte", "first_air_date.gte", "first_air_date.lte"]: data = self._validate_date(v) if data: validated[k] = data elif k in ["primary_release_year", "first_air_date_year", "vote_count.gte", "vote_count.lte", "with_runtime.gte", "with_runtime.lte"]: if not isinstance(v, int) or v <= 0: raise Invalid(f"{k} must be an integer greater than 0") validated[k] = v elif k in ["vote_average.gte", "vote_average.lte"]: if not isinstance(v, (int, float)) or v <= 0: raise Invalid(f"{k} must be a number greater than 0.0") validated[k] = float(v) elif k == "with_watch_monetization_types": if v not in ["flatrate", "free", "ads", "rent", "buy"]: raise Invalid(f"{v} is not a valid with_watch_monetization_types option. Options: [flatrate, free, ads, rent, or buy]") if "watch_region" not in kwargs: raise Invalid("with_watch_monetization_types must be used with watch_region") validated[k] = v else: validated[k] = ",".join([str(x) for x in v]) if isinstance(v, list) else str(v) return validated
(self, is_movie, **kwargs)
53,585
tmdbapis.tmdb
_validate_language
null
def _validate_language(self, language): if isinstance(language, Language): return language.iso_639_1 elif str(language).lower() in self._iso_639_1: return str(language).lower() else: raise Invalid(f"Language: {language} is invalid see Configuration.languages for the options.")
(self, language)
53,586
tmdbapis.tmdb
_validate_translation
null
def _validate_translation(self, translation): if str(translation).lower() in self._translations: return self._translations[str(translation).lower()] else: raise Invalid(f"Translation: {translation} is invalid see Configuration.primary_translations for the options.")
(self, translation)
53,587
tmdbapis.tmdb
account
:class:`~tmdbapis.objs.reload.Account` Object with your account details. Returns: :class:`~tmdbapis.objs.reload.Account` Raises: :class:`~tmdbapis.exceptions.Authentication`: When you haven't authenticated a session yet.
def account(self): """ :class:`~tmdbapis.objs.reload.Account` Object with your account details. Returns: :class:`~tmdbapis.objs.reload.Account` Raises: :class:`~tmdbapis.exceptions.Authentication`: When you haven't authenticated a session yet. """ return Account(self)
(self)
53,588
tmdbapis.tmdb
authenticate
Use this to authenticate the TMDb V3 Session. Parameters: username (str): TMDb Username. password (str): TMDb Password.
def authenticate(self, username: str, password: str): """ Use this to authenticate the TMDb V3 Session. Parameters: username (str): TMDb Username. password (str): TMDb Password. """ request_token = self._api.authentication_create_request_token()["request_token"] self._api.authentication_create_session_with_login(username, password, request_token) self._api.authentication_create_session(request_token)
(self, username: str, password: str)
53,589
tmdbapis.tmdb
collection
Gets the :class:`~tmdbapis.objs.reload.Collection` for the given id. Parameters: collection_id (int): Collection ID of the collection you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Collection` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no collection is found for the given id.
def collection(self, collection_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Collection: """ Gets the :class:`~tmdbapis.objs.reload.Collection` for the given id. Parameters: collection_id (int): Collection ID of the collection you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Collection` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no collection is found for the given id. """ return Collection(self, {"id": collection_id}, load=load, partial=partial)
(self, collection_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Collection
53,590
tmdbapis.tmdb
collection_search
Searches TMDb for collections. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCollections` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def collection_search(self, query: str) -> SearchCollections: """ Searches TMDb for collections. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCollections` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchCollections(self, query)
(self, query: str) -> tmdbapis.objs.pagination.SearchCollections
53,591
tmdbapis.tmdb
company
Gets the :class:`~tmdbapis.objs.reload.Company` for the given id. Parameters: company_id (int): Company ID of the company you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Company` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no company is found for the given id.
def company(self, company_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Company: """ Gets the :class:`~tmdbapis.objs.reload.Company` for the given id. Parameters: company_id (int): Company ID of the company you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Company` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no company is found for the given id. """ return Company(self, {"id": company_id}, load=load, partial=partial)
(self, company_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Company
53,592
tmdbapis.tmdb
company_search
Searches TMDb for companies. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCompanies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def company_search(self, query: str) -> SearchCompanies: """ Searches TMDb for companies. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchCompanies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchCompanies(self, query)
(self, query: str) -> tmdbapis.objs.pagination.SearchCompanies
53,593
tmdbapis.tmdb
configuration
Gets the TMDb :class:`~tmdbapis.objs.reload.Configuration`. Parameters: reload (bool): Reload the cached :class:`~tmdbapis.objs.reload.Configuration`. Returns: :class:`~tmdbapis.objs.reload.Configuration`
def configuration(self, reload: bool = False) -> Configuration: """ Gets the TMDb :class:`~tmdbapis.objs.reload.Configuration`. Parameters: reload (bool): Reload the cached :class:`~tmdbapis.objs.reload.Configuration`. Returns: :class:`~tmdbapis.objs.reload.Configuration` """ if reload or self._config is None: self._config = Configuration(self) return self._config
(self, reload: bool = False) -> tmdbapis.objs.reload.Configuration
53,594
tmdbapis.tmdb
create_list
Creates a new List on TMDb and returns either a :class:`~tmdbapis.objs.pagination.TMDbList` Object or the List ID. Parameters: name (str): Name of the List. iso_639_1 (Union[Language, str]): ISO 639-1 Language Code of the List or :class:`tmdbapis.objs.simple.Language` Object. description (Optional[str]): Description of the List. public (bool): Determine if the list is a public list. (V4 Lists Only) iso_3166_1 (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code of the List or :class:`tmdbapis.objs.simple.Country` Object. (V4 Lists Only) load (bool): Load the list to return after creating it or just return the created List ID. Returns: Union[:class:`~tmdbapis.objs.pagination.TMDbList`, int]
def create_list(self, name: str, iso_639_1: Union[Language, str], description: Optional[str] = "", public: bool = True, iso_3166_1: Optional[Union[Country, str]] = None, load: bool = True) -> Union[TMDbList, int]: """ Creates a new List on TMDb and returns either a :class:`~tmdbapis.objs.pagination.TMDbList` Object or the List ID. Parameters: name (str): Name of the List. iso_639_1 (Union[Language, str]): ISO 639-1 Language Code of the List or :class:`tmdbapis.objs.simple.Language` Object. description (Optional[str]): Description of the List. public (bool): Determine if the list is a public list. (V4 Lists Only) iso_3166_1 (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code of the List or :class:`tmdbapis.objs.simple.Country` Object. (V4 Lists Only) load (bool): Load the list to return after creating it or just return the created List ID. Returns: Union[:class:`~tmdbapis.objs.pagination.TMDbList`, int] """ if self._api4 and self._api4.has_write_token: list_id = self._v4_check(write=True).list_create_list( name, self._validate_language(iso_639_1), description=description, public=public, iso_3166_1=self._validate_country(iso_3166_1) )["id"] else: list_id = self._api.lists_create_list( name=name, description=description, language=self._validate_language(iso_639_1) )["list_id"] return self.list(list_id) if load else int(list_id)
(self, name: str, iso_639_1: Union[tmdbapis.objs.simple.Language, str], description: Optional[str] = '', public: bool = True, iso_3166_1: Union[tmdbapis.objs.simple.Country, str, NoneType] = None, load: bool = True) -> Union[tmdbapis.objs.pagination.TMDbList, int]
53,595
tmdbapis.tmdb
created_lists
Paginated Object of all the lists created by an account. Will include private lists if you are the owner. Parameters: v3 (bool): Force List V3 Usage Returns: :class:`~tmdbapis.objs.pagination.CreatedLists`
def created_lists(self, v3: bool = False): """ Paginated Object of all the lists created by an account. Will include private lists if you are the owner. Parameters: v3 (bool): Force List V3 Usage Returns: :class:`~tmdbapis.objs.pagination.CreatedLists` """ return CreatedLists(self, v3=v3)
(self, v3: bool = False)
53,596
tmdbapis.tmdb
credit
Gets the :class:`~tmdbapis.objs.reload.Credit` for the given id. Parameters: credit_id (str): Credit ID of the credit you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Credit` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no credit is found for the given id.
def credit(self, credit_id: str, load: bool = True) -> Credit: """ Gets the :class:`~tmdbapis.objs.reload.Credit` for the given id. Parameters: credit_id (str): Credit ID of the credit you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Credit` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no credit is found for the given id. """ return Credit(self, {"id": credit_id, "person": {}}, load=load)
(self, credit_id: str, load: bool = True) -> tmdbapis.objs.reload.Credit
53,597
tmdbapis.tmdb
discover_movies
Discover movies by different types of data like average rating, number of votes, genres and certifications. You can get a valid list of certifications from the :meth:`movie_certifications` method. Discover also supports a nice list of sort options. See below for all of the available options. Please note, when using ``certification`` \ ``certification.lte`` you must also specify ``certification_country``. These two parameters work together in order to filter the results. You can only filter results with the countries added to :meth:`movie_certifications`. If you specify the ``region`` parameter, the regional release date will be used instead of the primary release date. The date returned will be the first date based on your query (ie. if a ``with_release_type`` is specified). It's important to note the order of the release types that are used. Specifying "2|3" would return the limited theatrical release date as opposed to "3|2" which would return the theatrical date. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. region (Optional[str]): ISO-3166-1 code to filter release dates. Must be uppercase. sort_by (Optional[str]): Allowed Values: ``popularity.asc``, ``popularity.desc``, ``release_date.asc``, ``release_date.desc``, ``revenue.asc``, ``revenue.desc``, ``primary_release_date.asc``, ``primary_release_date.desc``, ``original_title.asc``, ``original_title.desc``, ``vote_average.asc``, ``vote_average.desc``, ``vote_count.asc``, ``vote_count.desc`` certification_country (Optional[str]): Used in conjunction with the ``certification`` filter, use this to specify a country with a valid certification. certification (Optional[str]): Filter results with a valid certification from the ``certification_country`` field. certification.lte (Optional[str]): Filter and only include movies that have a certification that is less than or equal to the specified value. certification.gte (Optional[str]): Filter and only include movies that have a certification that is greater than or equal to the specified value. include_adult (Optional[bool]): A filter and include or exclude adult movies. include_video (Optional[bool]): A filter to include or exclude videos. page (Optional[int]): Specify the page of results to query. primary_release_year (Optional[int): A filter to limit the results to a specific primary release year. primary_release_date.gte (Optional[str]): Filter and only include movies that have a primary release date that is greater or equal to the specified value. Format: YYYY-MM-DD primary_release_date.lte (Optional[str]): Filter and only include movies that have a primary release date that is less than or equal to the specified value. Format: YYYY-MM-DD release_date.gte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is greater or equal to the specified value. Format: YYYY-MM-DD release_date.lte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is less than or equal to the specified value. Format: YYYY-MM-DD with_release_type (Optional[int]): Specify a comma (AND) or pipe (OR) separated value to filter release types by. These release types map to the same values found on the movie release date method. year (Optional[int]): A filter to limit the results to a specific year (looking at all release dates). vote_count.gte (Optional[int]): Filter and only include movies that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include movies that have a vote count that is less than or equal to the specified value. vote_average.gte (Optional[float]): Filter and only include movies that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include movies that have a rating that is less than or equal to the specified value. with_cast (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as an actor. with_crew (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a crew member. with_people (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a either a actor or a crew member. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes movies that have one of the ID's added as a keyword. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. with_runtime.gte (Optional[int]): Filter and only include movies that have a runtime that is greater or equal to a value. with_runtime.lte (Optional[int]): Filter and only include movies that have a runtime that is less than or equal to a value. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. with_title_translation (Optional[str]): Specify a Primary Translation string to filter results by their title translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid.
def discover_movies(self, **kwargs) -> DiscoverMovies: """ Discover movies by different types of data like average rating, number of votes, genres and certifications. You can get a valid list of certifications from the :meth:`movie_certifications` method. Discover also supports a nice list of sort options. See below for all of the available options. Please note, when using ``certification`` \\ ``certification.lte`` you must also specify ``certification_country``. These two parameters work together in order to filter the results. You can only filter results with the countries added to :meth:`movie_certifications`. If you specify the ``region`` parameter, the regional release date will be used instead of the primary release date. The date returned will be the first date based on your query (ie. if a ``with_release_type`` is specified). It's important to note the order of the release types that are used. Specifying "2|3" would return the limited theatrical release date as opposed to "3|2" which would return the theatrical date. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. region (Optional[str]): ISO-3166-1 code to filter release dates. Must be uppercase. sort_by (Optional[str]): Allowed Values: ``popularity.asc``, ``popularity.desc``, ``release_date.asc``, ``release_date.desc``, ``revenue.asc``, ``revenue.desc``, ``primary_release_date.asc``, ``primary_release_date.desc``, ``original_title.asc``, ``original_title.desc``, ``vote_average.asc``, ``vote_average.desc``, ``vote_count.asc``, ``vote_count.desc`` certification_country (Optional[str]): Used in conjunction with the ``certification`` filter, use this to specify a country with a valid certification. certification (Optional[str]): Filter results with a valid certification from the ``certification_country`` field. certification.lte (Optional[str]): Filter and only include movies that have a certification that is less than or equal to the specified value. certification.gte (Optional[str]): Filter and only include movies that have a certification that is greater than or equal to the specified value. include_adult (Optional[bool]): A filter and include or exclude adult movies. include_video (Optional[bool]): A filter to include or exclude videos. page (Optional[int]): Specify the page of results to query. primary_release_year (Optional[int): A filter to limit the results to a specific primary release year. primary_release_date.gte (Optional[str]): Filter and only include movies that have a primary release date that is greater or equal to the specified value. Format: YYYY-MM-DD primary_release_date.lte (Optional[str]): Filter and only include movies that have a primary release date that is less than or equal to the specified value. Format: YYYY-MM-DD release_date.gte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is greater or equal to the specified value. Format: YYYY-MM-DD release_date.lte (Optional[str]): Filter and only include movies that have a release date (looking at all release dates) that is less than or equal to the specified value. Format: YYYY-MM-DD with_release_type (Optional[int]): Specify a comma (AND) or pipe (OR) separated value to filter release types by. These release types map to the same values found on the movie release date method. year (Optional[int]): A filter to limit the results to a specific year (looking at all release dates). vote_count.gte (Optional[int]): Filter and only include movies that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include movies that have a vote count that is less than or equal to the specified value. vote_average.gte (Optional[float]): Filter and only include movies that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include movies that have a rating that is less than or equal to the specified value. with_cast (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as an actor. with_crew (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a crew member. with_people (Optional[str]): A comma separated list of person ID's. Only include movies that have one of the ID's added as a either a actor or a crew member. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes movies that have one of the ID's added as a keyword. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. with_runtime.gte (Optional[int]): Filter and only include movies that have a runtime that is greater or equal to a value. with_runtime.lte (Optional[int]): Filter and only include movies that have a runtime that is less than or equal to a value. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. with_title_translation (Optional[str]): Specify a Primary Translation string to filter results by their title translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid. """ return DiscoverMovies(self, **self._validate_discover(True, **kwargs))
(self, **kwargs) -> tmdbapis.objs.pagination.DiscoverMovies
53,598
tmdbapis.tmdb
discover_tv_shows
Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. Discover also supports a nice list of sort options. See below for all of the available options. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. sort_by (Optional[str]): Allowed Values: ``vote_average.desc``, ``vote_average.asc``, ``first_air_date.desc``, ``first_air_date.asc``, ``popularity.desc``, ``popularity.asc`` air_date.gte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is greater or equal to the specified value. Format: YYYY-MM-DD air_date.lte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is less than or equal to the specified value. Format: YYYY-MM-DD first_air_date.gte (Optional[str]): Filter and only include TV shows that have a original air date that is greater or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date.lte (Optional[str]): Filter and only include TV shows that have a original air date that is less than or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date_year (Optional[int]): Filter and only include TV shows that have a original air date year that equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. page (Optional[int]): Specify the page of results to query. timezone (Optional[str]): Used in conjunction with the ``air_date.gte``/``air_date.lte`` filter to calculate the proper UTC offset. vote_average.gte (Optional[float]): Filter and only include TV shows that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include TV shows that have a rating that is less than or equal to the specified value. vote_count.gte (Optional[int]): Filter and only include TV shows that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include TV shows that have a vote count that is less than or equal to the specified value. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. with_networks (Optional[str]): Comma separated value of network ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_runtime.gte (Optional[int]): Filter and only include TV shows with an episode runtime that is greater than or equal to a value. with_runtime.lte (Optional[int]): Filter and only include TV shows with an episode runtime that is less than or equal to a value. include_null_first_air_dates (Optional[bool]): Use this filter to include TV shows that don't have an air date while using any of the ``first_air_date`` filters. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. screened_theatrically (Optional[bool]): Filter results to include items that have been screened theatrically. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes TV shows that have one of the ID's added as a keyword. with_name_translation (Optional[str]): Specify a Primary Translation string to filter results by their name translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid.
def discover_tv_shows(self, **kwargs) -> DiscoverTVShows: """ Discover TV shows by different types of data like average rating, number of votes, genres, the network they aired on and air dates. Discover also supports a nice list of sort options. See below for all of the available options. Also note that a number of filters support being comma (``,``) or pipe (``|``) separated. Comma's are treated like an ``AND`` and query while pipe's are an ``OR``. ``.`` cannot be included directly in the function parameters so the parameters must be provided as a kwargs dictionary. Parameters: language (Optional[str]): ISO-639-1 or ISO-3166-1 value to display translated data for the fields that support it. sort_by (Optional[str]): Allowed Values: ``vote_average.desc``, ``vote_average.asc``, ``first_air_date.desc``, ``first_air_date.asc``, ``popularity.desc``, ``popularity.asc`` air_date.gte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is greater or equal to the specified value. Format: YYYY-MM-DD air_date.lte (Optional[str]): Filter and only include TV shows that have a air date (by looking at all episodes) that is less than or equal to the specified value. Format: YYYY-MM-DD first_air_date.gte (Optional[str]): Filter and only include TV shows that have a original air date that is greater or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date.lte (Optional[str]): Filter and only include TV shows that have a original air date that is less than or equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. Format: YYYY-MM-DD first_air_date_year (Optional[int]): Filter and only include TV shows that have a original air date year that equal to the specified value. Can be used in conjunction with the ``include_null_first_air_dates`` filter if you want to include items with no air date. page (Optional[int]): Specify the page of results to query. timezone (Optional[str]): Used in conjunction with the ``air_date.gte``/``air_date.lte`` filter to calculate the proper UTC offset. vote_average.gte (Optional[float]): Filter and only include TV shows that have a rating that is greater or equal to the specified value. vote_average.lte (Optional[float]): Filter and only include TV shows that have a rating that is less than or equal to the specified value. vote_count.gte (Optional[int]): Filter and only include TV shows that have a vote count that is greater or equal to the specified value. vote_count.lte (Optional[int]): Filter and only include TV shows that have a vote count that is less than or equal to the specified value. with_genres (Optional[str]): Comma separated value of genre ids that you want to include in the results. with_networks (Optional[str]): Comma separated value of network ids that you want to include in the results. without_genres (Optional[str]): Comma separated value of genre ids that you want to exclude from the results. with_runtime.gte (Optional[int]): Filter and only include TV shows with an episode runtime that is greater than or equal to a value. with_runtime.lte (Optional[int]): Filter and only include TV shows with an episode runtime that is less than or equal to a value. include_null_first_air_dates (Optional[bool]): Use this filter to include TV shows that don't have an air date while using any of the ``first_air_date`` filters. with_original_language (Optional[str]): Specify an ISO 639-1 string to filter results by their original language value. without_keywords (Optional[str]): Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. screened_theatrically (Optional[bool]): Filter results to include items that have been screened theatrically. with_companies (Optional[str]): A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. with_keywords (Optional[str]): A comma separated list of keyword ID's. Only includes TV shows that have one of the ID's added as a keyword. with_name_translation (Optional[str]): Specify a Primary Translation string to filter results by their name translation value. with_overview_translation (Optional[str]): Specify a Primary Translation string to filter results by their overview translation value. with_watch_providers (Optional[str]): A comma or pipe separated list of watch provider ID's. Combine this filter with ``watch_region`` in order to filter your results by a specific watch provider in a specific region. watch_region (Optional[str]): An ISO 3166-1 code. Combine this filter with ``with_watch_providers`` in order to filter your results by a specific watch provider in a specific region. with_watch_monetization_types (Optional[str]): In combination with ``watch_region``, you can filter by monetization type. Allowed Values: ``flatrate``, ``free``, ``ads``, ``rent``, ``buy`` Returns: :class:`~tmdbapis.objs.pagination.DiscoverTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When one of the attributes given is Invalid. """ return DiscoverTVShows(self, **self._validate_discover(False, **kwargs))
(self, **kwargs) -> tmdbapis.objs.pagination.DiscoverTVShows
53,599
tmdbapis.tmdb
episode_group
Gets the :class:`~tmdbapis.objs.reload.EpisodeGroup` for the given id. Parameters: episode_group_id (str): Episode Group ID that you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.EpisodeGroup` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id.
def episode_group(self, episode_group_id: str, load: bool = True) -> EpisodeGroup: """ Gets the :class:`~tmdbapis.objs.reload.EpisodeGroup` for the given id. Parameters: episode_group_id (str): Episode Group ID that you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.EpisodeGroup` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return EpisodeGroup(self, {"id": episode_group_id}, load=load)
(self, episode_group_id: str, load: bool = True) -> tmdbapis.objs.reload.EpisodeGroup
53,600
tmdbapis.tmdb
favorite_movies
Paginated Object of movies you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def favorite_movies(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return FavoriteMovies(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,601
tmdbapis.tmdb
favorite_tv_shows
Paginated Object of TV shows you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def favorite_tv_shows(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have marked as a favorite. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.FavoriteTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return FavoriteTVShows(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,602
tmdbapis.tmdb
find_by_id
Gets the :class:`~tmdbapis.objs.simple.FindResults` for the given external id. Parameters: imdb_id (str): IMDb ID to find. freebase_mid (str): Freebase MID to find. freebase_id (str): Freebase ID to find. tvdb_id (str): TVDb ID to find. tvrage_id (str): TVRage ID to find. facebook_id (str): Facebook ID to find. twitter_id (str): Twitter ID to find. instagram_id (str): Instagram ID to find. Returns: :class:`~tmdbapis.objs.simple.FindResults` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are returned. :class:`~tmdbapis.exceptions.Invalid`: When no external id is given.
def find_by_id(self, imdb_id: Optional[str] = None, freebase_mid: Optional[str] = None, freebase_id: Optional[str] = None, tvdb_id: Optional[str] = None, tvrage_id: Optional[str] = None, facebook_id: Optional[str] = None, twitter_id: Optional[str] = None, instagram_id: Optional[str] = None) -> FindResults: """ Gets the :class:`~tmdbapis.objs.simple.FindResults` for the given external id. Parameters: imdb_id (str): IMDb ID to find. freebase_mid (str): Freebase MID to find. freebase_id (str): Freebase ID to find. tvdb_id (str): TVDb ID to find. tvrage_id (str): TVRage ID to find. facebook_id (str): Facebook ID to find. twitter_id (str): Twitter ID to find. instagram_id (str): Instagram ID to find. Returns: :class:`~tmdbapis.objs.simple.FindResults` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are returned. :class:`~tmdbapis.exceptions.Invalid`: When no external id is given. """ if imdb_id: return FindResults(self, imdb_id, "imdb_id") elif freebase_mid: return FindResults(self, freebase_mid, "freebase_mid") elif freebase_id: return FindResults(self, freebase_id, "freebase_id") elif tvdb_id: return FindResults(self, tvdb_id, "tvdb_id") elif tvrage_id: return FindResults(self, tvrage_id, "tvrage_id") elif facebook_id: return FindResults(self, facebook_id, "facebook_id") elif twitter_id: return FindResults(self, twitter_id, "twitter_id") elif instagram_id: return FindResults(self, instagram_id, "instagram_id") else: raise Invalid("At least one ID is required")
(self, imdb_id: Optional[str] = None, freebase_mid: Optional[str] = None, freebase_id: Optional[str] = None, tvdb_id: Optional[str] = None, tvrage_id: Optional[str] = None, facebook_id: Optional[str] = None, twitter_id: Optional[str] = None, instagram_id: Optional[str] = None) -> tmdbapis.objs.simple.FindResults
53,603
tmdbapis.tmdb
keyword
Gets the :class:`~tmdbapis.objs.reload.Keyword` for the given id. Parameters: keyword_id (int): Keyword ID of the keyword you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Keyword` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id.
def keyword(self, keyword_id: int, load: bool = True) -> Keyword: """ Gets the :class:`~tmdbapis.objs.reload.Keyword` for the given id. Parameters: keyword_id (int): Keyword ID of the keyword you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Keyword` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Keyword(self, {"id": keyword_id}, load=load)
(self, keyword_id: int, load: bool = True) -> tmdbapis.objs.reload.Keyword
53,604
tmdbapis.tmdb
keyword_search
Searches TMDb for keywords. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchKeywords` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def keyword_search(self, query: str) -> SearchKeywords: """ Searches TMDb for keywords. Parameters: query (str): Query to search for. Returns: :class:`~tmdbapis.objs.pagination.SearchKeywords` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchKeywords(self, query)
(self, query: str) -> tmdbapis.objs.pagination.SearchKeywords
53,605
tmdbapis.tmdb
latest_movie
Gets the latest :class:`~tmdbapis.objs.reload.Movie` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Movie`
def latest_movie(self) -> Movie: """ Gets the latest :class:`~tmdbapis.objs.reload.Movie` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Movie` """ return Movie(self, self._api.movies_get_latest(language=self.language))
(self) -> tmdbapis.objs.reload.Movie
53,606
tmdbapis.tmdb
latest_person
Gets the latest :class:`~tmdbapis.objs.reload.Person` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Person`
def latest_person(self) -> Person: """ Gets the latest :class:`~tmdbapis.objs.reload.Person` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.Person` """ return Person(self, self._api.people_get_latest(language=self.language))
(self) -> tmdbapis.objs.reload.Person
53,607
tmdbapis.tmdb
latest_tv
Gets the latest :class:`~tmdbapis.objs.reload.TVShow` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.TVShow`
def latest_tv(self) -> TVShow: """ Gets the latest :class:`~tmdbapis.objs.reload.TVShow` added on TMDb. Returns: :class:`~tmdbapis.objs.reload.TVShow` """ return TVShow(self, self._api.tv_get_latest(language=self.language))
(self) -> tmdbapis.objs.reload.TVShow
53,608
tmdbapis.tmdb
list
Gets the :class:`~tmdbapis.objs.pagination.TMDbList` for the given id. Parameters: list_id (str): Keyword ID of the list you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.pagination.TMDbList` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no list is found for the given id.
def list(self, list_id: int, load: bool = True) -> TMDbList: """ Gets the :class:`~tmdbapis.objs.pagination.TMDbList` for the given id. Parameters: list_id (str): Keyword ID of the list you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.pagination.TMDbList` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no list is found for the given id. """ return TMDbList(self, {"id": list_id}, load=load)
(self, list_id: int, load: bool = True) -> tmdbapis.objs.pagination.TMDbList
53,609
tmdbapis.tmdb
logout
End all V3 and V4 Authenticated Sessions
def logout(self): """ End all V3 and V4 Authenticated Sessions """ if self._api._session_id: self._api.authentication_delete_session(self._api._session_id) if self._api4: if self._api4.has_write_token: self._api4.auth_delete_access_token(self._api4.access_token)
(self)
53,610
tmdbapis.tmdb
movie
Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: movie_id (str): Movie ID of the movie you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Movie` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id.
def movie(self, movie_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Movie: """ Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: movie_id (str): Movie ID of the movie you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Movie` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Movie(self, {"id": movie_id}, load=load, partial=partial)
(self, movie_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Movie
53,611
tmdbapis.tmdb
movie_certifications
Get an up to date list of the officially supported movie certifications on TMDB. Parameters: reload (bool): Reload the cached movie certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`]
def movie_certifications(self, reload: bool = False) -> Dict[str, CountryCertifications]: """ Get an up to date list of the officially supported movie certifications on TMDB. Parameters: reload (bool): Reload the cached movie certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`] """ if reload or self._movie_certifications is None: self._movie_certifications = self._parse(data=self._api.certifications_get_movie_certifications(), attrs="certifications", value_type="country_certification", is_dict=True) return self._movie_certifications
(self, reload: bool = False) -> Dict[str, tmdbapis.objs.simple.CountryCertifications]
53,612
tmdbapis.tmdb
movie_change_list
Get a list of :class:`~tmdbapis.objs.reload.Movie` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Movies at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.Movie`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format.
def movie_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[Movie]: """ Get a list of :class:`~tmdbapis.objs.reload.Movie` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Movies at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.Movie`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [Movie(self, data) for data in self._api.changes_get_movie_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]]
(self, start_date: Union[datetime.datetime, str, NoneType] = None, end_date: Union[datetime.datetime, str, NoneType] = None) -> List[tmdbapis.objs.reload.Movie]
53,613
tmdbapis.tmdb
movie_genres
Gets a list of all movie :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`]
def movie_genres(self, reload: bool = False) -> List[Genre]: """ Gets a list of all movie :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`] """ if reload or self._movie_genres is None: self._movie_genres = self._parse(data=self._api.genres_get_movie_list(), attrs="genres", value_type="load_genre", is_list=True) return self._movie_genres
(self, reload: bool = False) -> List[tmdbapis.objs.simple.Genre]
53,614
tmdbapis.tmdb
movie_providers
Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for movies. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[WatchProvider]`
def movie_providers(self, watch_region: Optional[Union[Country, str]] = None, reload: bool = False) -> List[WatchProvider]: """ Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for movies. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[WatchProvider]` """ if reload or self._movie_providers is None: self._movie_providers = [ WatchProvider(self, w) for w in self._api.watch_providers_get_movie_providers(self.language, watch_region=watch_region)["results"] ] return self._movie_providers
(self, watch_region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None, reload: bool = False) -> List[tmdbapis.objs.simple.WatchProvider]
53,615
tmdbapis.tmdb
movie_recommendations
Paginated Object of your personal movie recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` - ``release_date.desc`` * - ``title.asc`` - ``title.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.pagination.MovieRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def movie_recommendations(self, sort_by: Optional[str] = None): """ Paginated Object of your personal movie recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` - ``release_date.desc`` * - ``title.asc`` - ``title.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.pagination.MovieRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return MovieRecommendations(self, sort_by=sort_by)
(self, sort_by: Optional[str] = None)
53,616
tmdbapis.tmdb
movie_search
Searches TMDb for movies. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. year (Optional[int]): Specify a year for the search. primary_release_year (Optional[int]): Specify a primary release year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchMovies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def movie_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None, year: Optional[int] = None, primary_release_year: Optional[int] = None) -> SearchMovies: """ Searches TMDb for movies. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. year (Optional[int]): Specify a year for the search. primary_release_year (Optional[int]): Specify a primary release year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchMovies` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchMovies(self, query, include_adult=include_adult, region=self._validate_country(region), year=year, primary_release_year=primary_release_year)
(self, query: str, include_adult: Optional[bool] = None, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None, year: Optional[int] = None, primary_release_year: Optional[int] = None) -> tmdbapis.objs.pagination.SearchMovies
53,617
tmdbapis.tmdb
movie_watchlist
Paginated Object of movies you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.MovieWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def movie_watchlist(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.MovieWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return MovieWatchlist(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,618
tmdbapis.tmdb
multi_search
Searches TMDb for movies, tv shows, and people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchMulti` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def multi_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None) -> SearchMulti: """ Searches TMDb for movies, tv shows, and people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchMulti` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchMulti(self, query, include_adult=include_adult, region=self._validate_country(region))
(self, query: str, include_adult: Optional[bool] = None, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.SearchMulti
53,619
tmdbapis.tmdb
network
Gets the :class:`~tmdbapis.objs.reload.Network` for the given id. Parameters: network_id (int): Network ID of the network you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Network` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no network is found for the given id.
def network(self, network_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Network: """ Gets the :class:`~tmdbapis.objs.reload.Network` for the given id. Parameters: network_id (int): Network ID of the network you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Network` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no network is found for the given id. """ return Network(self, {"id": network_id}, load=load, partial=partial)
(self, network_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Network
53,620
tmdbapis.tmdb
now_playing_movies
Paginated Object of Movies Now playing in theaters. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.NowPlayingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid.
def now_playing_movies(self, region: Optional[Union[Country, str]] = None) -> NowPlayingMovies: """ Paginated Object of Movies Now playing in theaters. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.NowPlayingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return NowPlayingMovies(self, region=self._validate_country(region))
(self, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.NowPlayingMovies
53,621
tmdbapis.tmdb
people_search
Searches TMDb for people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchPeople` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def people_search(self, query: str, include_adult: Optional[bool] = None, region: Optional[Union[Country, str]] = None) -> SearchPeople: """ Searches TMDb for people. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. Returns: :class:`~tmdbapis.objs.pagination.SearchPeople` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchPeople(self, query, include_adult=include_adult, region=self._validate_country(region))
(self, query: str, include_adult: Optional[bool] = None, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.SearchPeople
53,622
tmdbapis.tmdb
person
Gets the :class:`~tmdbapis.objs.reload.Person` for the given id. Parameters: person_id (int): Person ID of the person you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Person` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no person is found for the given id.
def person(self, person_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Person: """ Gets the :class:`~tmdbapis.objs.reload.Person` for the given id. Parameters: person_id (int): Person ID of the person you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Person` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no person is found for the given id. """ return Person(self, {"id": person_id}, load=load, partial=partial)
(self, person_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Person
53,623
tmdbapis.tmdb
person_change_list
Get a list of :class:`~tmdbapis.objs.pagination.Person` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed People at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.pagination.Person`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format.
def person_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[Person]: """ Get a list of :class:`~tmdbapis.objs.pagination.Person` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed People at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.pagination.Person`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [Person(self, data) for data in self._api.changes_get_person_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]]
(self, start_date: Union[datetime.datetime, str, NoneType] = None, end_date: Union[datetime.datetime, str, NoneType] = None) -> List[tmdbapis.objs.reload.Person]
53,624
tmdbapis.tmdb
popular_movies
Paginated Object of Popular Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.PopularMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid.
def popular_movies(self, region: Optional[Union[Country, str]] = None) -> PopularMovies: """ Paginated Object of Popular Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.PopularMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return PopularMovies(self, region=self._validate_country(region))
(self, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.PopularMovies
53,625
tmdbapis.tmdb
popular_people
Paginated Object of Popular People on TMDb. Returns: :class:`~tmdbapis.objs.pagination.PopularPeople`
def popular_people(self) -> PopularPeople: """ Paginated Object of Popular People on TMDb. Returns: :class:`~tmdbapis.objs.pagination.PopularPeople` """ return PopularPeople(self)
(self) -> tmdbapis.objs.pagination.PopularPeople
53,626
tmdbapis.tmdb
popular_tv
Paginated Object of Popular TV Shows. Returns: :class:`~tmdbapis.objs.pagination.PopularTVShows`
def popular_tv(self) -> PopularTVShows: """ Paginated Object of Popular TV Shows. Returns: :class:`~tmdbapis.objs.pagination.PopularTVShows` """ return PopularTVShows(self)
(self) -> tmdbapis.objs.pagination.PopularTVShows
53,627
tmdbapis.tmdb
provider_regions
Gets a List of :class:`~tmdbapis.objs.simple.Country`. Parameters: reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]`
def provider_regions(self, reload: bool = False) -> List[Country]: """ Gets a List of :class:`~tmdbapis.objs.simple.Country`. Parameters: reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]` """ if reload or self._provider_regions is None: self._provider_regions = [ Country(self, c) for c in self._api.watch_providers_get_available_regions(self.language) ] return self._provider_regions
(self, reload: bool = False) -> List[tmdbapis.objs.simple.Country]
53,628
tmdbapis.tmdb
rated_episodes
Paginated Object of TV episodes you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` Returns: :class:`~tmdbapis.objs.pagination.RatedEpisodes` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def rated_episodes(self, sort_by: Optional[str] = None): """ Paginated Object of TV episodes you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` Returns: :class:`~tmdbapis.objs.pagination.RatedEpisodes` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedEpisodes(self, sort_by=sort_by)
(self, sort_by: Optional[str] = None)
53,629
tmdbapis.tmdb
rated_movies
Paginated Object of movies you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def rated_movies(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of movies you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``release_date.asc`` * - ``release_date.desc`` * * - ``title.asc`` * - ``title.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedMovies(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,630
tmdbapis.tmdb
rated_tv_shows
Paginated Object of TV shows you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def rated_tv_shows(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have rated. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.pagination.RatedTVShows` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return RatedTVShows(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,631
tmdbapis.tmdb
review
Gets the :class:`~tmdbapis.objs.reload.Review` for the given id. Parameters: review_id (str): Review ID of the review you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Review` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no review is found for the given id.
def review(self, review_id: str, load: bool = True) -> Review: """ Gets the :class:`~tmdbapis.objs.reload.Review` for the given id. Parameters: review_id (str): Review ID of the review you want. load (bool): Load the data on creation. Returns: :class:`~tmdbapis.objs.reload.Review` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no review is found for the given id. """ return Review(self, {"id": review_id}, load=load)
(self, review_id: str, load: bool = True) -> tmdbapis.objs.reload.Review
53,632
tmdbapis.tmdb
top_rated_movies
Paginated Object of the Top Rated Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.TopRatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid.
def top_rated_movies(self, region: Optional[Union[Country, str]] = None) -> TopRatedMovies: """ Paginated Object of the Top Rated Movies on TMDb. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.TopRatedMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return TopRatedMovies(self, region=self._validate_country(region))
(self, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.TopRatedMovies
53,633
tmdbapis.tmdb
top_rated_tv
Paginated Object of Top Rated TV Shows On. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir`
def top_rated_tv(self) -> TopRatedTVShows: """ Paginated Object of Top Rated TV Shows On. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir` """ return TopRatedTVShows(self)
(self) -> tmdbapis.objs.pagination.TopRatedTVShows
53,634
tmdbapis.tmdb
trending
Gets the :class:`~tmdbapis.objs.pagination.Trending` for the given id. Parameters: media_type (str): Trending media type. Allowed Values: ``all``, ``movie``, ``tv``, and ``person`` time_window (str): Trending list time window. Allowed Values: ``day`` and ``week`` Returns: :class:`~tmdbapis.objs.pagination.Trending` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``media_type`` or ``time_window`` is given an invalid option.
def trending(self, media_type: str, time_window: str) -> Trending: """ Gets the :class:`~tmdbapis.objs.pagination.Trending` for the given id. Parameters: media_type (str): Trending media type. Allowed Values: ``all``, ``movie``, ``tv``, and ``person`` time_window (str): Trending list time window. Allowed Values: ``day`` and ``week`` Returns: :class:`~tmdbapis.objs.pagination.Trending` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``media_type`` or ``time_window`` is given an invalid option. """ if media_type not in ["all", "movie", "tv", "person"]: raise Invalid(f"media_type: {media_type} Invalid. Options: all, movie, tv, or person") if time_window not in ["day", "week"]: raise Invalid(f"time_window: {time_window} Invalid. Options: day or week") return Trending(self, media_type, time_window)
(self, media_type: str, time_window: str) -> tmdbapis.objs.pagination.Trending
53,635
tmdbapis.tmdb
tv_airing_today
Paginated Object of TV Shows Airing Today. Returns: :class:`~tmdbapis.objs.reload.TVShowsAiringToday`
def tv_airing_today(self) -> TVShowsAiringToday: """ Paginated Object of TV Shows Airing Today. Returns: :class:`~tmdbapis.objs.reload.TVShowsAiringToday` """ return TVShowsAiringToday(self)
(self) -> tmdbapis.objs.pagination.TVShowsAiringToday
53,636
tmdbapis.tmdb
tv_certifications
Get an up to date list of the officially supported TV show certifications on TMDB. Parameters: reload (bool): Reload the cached tv certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`]
def tv_certifications(self, reload: bool = False) -> Dict[str, CountryCertifications]: """ Get an up to date list of the officially supported TV show certifications on TMDB. Parameters: reload (bool): Reload the cached tv certifications Returns: Dict[str, :class:`~tmdbapis.objs.simple.CountryCertifications`] """ if reload or self._tv_certifications is None: self._tv_certifications = self._parse(data=self._api.certifications_get_tv_certifications(), attrs="certifications", value_type="country_certification", is_dict=True) return self._tv_certifications
(self, reload: bool = False) -> Dict[str, tmdbapis.objs.simple.CountryCertifications]
53,637
tmdbapis.tmdb
tv_change_list
Get a list of :class:`~tmdbapis.objs.reload.TV` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Shows at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.TVShow`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format.
def tv_change_list(self, start_date: Optional[Union[datetime, str]] = None, end_date: Optional[Union[datetime, str]] = None ) -> List[TVShow]: """ Get a list of :class:`~tmdbapis.objs.reload.TV` that have been changed in the past 24 hours. You can query it for up to 14 days worth of changed Shows at a time with the ``start_date`` and ``end_date`` query parameters. Parameters: start_date (Optional[Union[datetime, str]]): Filter the results with a start date. Format: YYYY-MM-DD end_date (Optional[Union[datetime, str]]): Filter the results with an end date. Format: YYYY-MM-DD Returns: List[:class:`~tmdbapis.objs.reload.TVShow`] Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``start_date`` or ``end_date`` is in an incorrect format. """ return [TVShow(self, data) for data in self._api.changes_get_tv_change_list( start_date=self._validate_date(start_date), end_date=self._validate_date(end_date) )["results"]]
(self, start_date: Union[datetime.datetime, str, NoneType] = None, end_date: Union[datetime.datetime, str, NoneType] = None) -> List[tmdbapis.objs.reload.TVShow]
53,638
tmdbapis.tmdb
tv_episode
Gets the :class:`~tmdbapis.objs.reload.Episode` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. episode_number (int): Episode number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Episode` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id.
def tv_episode(self, tv_id: int, season_number: int, episode_number: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Episode: """ Gets the :class:`~tmdbapis.objs.reload.Episode` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. episode_number (int): Episode number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Episode` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return Episode(self, {"season_number": season_number, "episode_number": episode_number}, tv_id, load=load, partial=partial)
(self, tv_id: int, season_number: int, episode_number: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Episode
53,639
tmdbapis.tmdb
tv_genres
Gets a list of all TV show :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`]
def tv_genres(self, reload: bool = False) -> List[Genre]: """ Gets a list of all TV show :class:`~tmdbapis.objs.simple.Genre`. Parameters: reload (bool): Reload the cached movie genres. Returns: List[:class:`~tmdbapis.objs.simple.Genre`] """ if reload or self._tv_genres is None: self._tv_genres = self._parse(data=self._api.genres_get_tv_list(), attrs="genres", value_type="load_genre", is_list=True) return self._tv_genres
(self, reload: bool = False) -> List[tmdbapis.objs.simple.Genre]
53,640
tmdbapis.tmdb
tv_on_the_air
Paginated Object of TV Shows On the Air. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir`
def tv_on_the_air(self) -> TVShowsOnTheAir: """ Paginated Object of TV Shows On the Air. Returns: :class:`~tmdbapis.objs.reload.TVShowsOnTheAir` """ return TVShowsOnTheAir(self)
(self) -> tmdbapis.objs.pagination.TVShowsOnTheAir
53,641
tmdbapis.tmdb
tv_providers
Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for shows. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]`
def tv_providers(self, watch_region: Optional[Union[Country, str]] = None, reload: bool = False) -> List[WatchProvider]: """ Gets a List of :class:`~tmdbapis.objs.simple.WatchProvider` for shows. Parameters: watch_region (Optional[Union[Country, str]]): Specify a ISO 3166-1 code or :class:`tmdbapis.objs.simple.Country` Object to filter release dates. Must be uppercase. reload (bool): Reload the cached data. Returns: :class:`~tmdbapis.objs.reload.List[Country]` """ if reload or self._tv_providers is None: self._tv_providers = [ WatchProvider(self, w) for w in self._api.watch_providers_get_tv_providers(self.language, watch_region=watch_region)["results"] ] return self._tv_providers
(self, watch_region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None, reload: bool = False) -> List[tmdbapis.objs.simple.WatchProvider]
53,642
tmdbapis.tmdb
tv_search
Searches TMDb for tv shows. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. first_air_date_year (Optional[int]): Specify a first air date year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchTVShows` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search.
def tv_search(self, query: str, include_adult: Optional[bool] = None, first_air_date_year: Optional[int] = None) -> SearchTVShows: """ Searches TMDb for tv shows. Parameters: query (str): Query to search for. include_adult (Optional[bool]): Choose whether to include adult (pornography) content in the results. first_air_date_year (Optional[int]): Specify a first air date year for the search. Returns: :class:`~tmdbapis.objs.pagination.SearchTVShows` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no results are found for the search. """ return SearchTVShows(self, query, include_adult=include_adult, first_air_date_year=first_air_date_year)
(self, query: str, include_adult: Optional[bool] = None, first_air_date_year: Optional[int] = None) -> tmdbapis.objs.pagination.SearchTVShows
53,643
tmdbapis.tmdb
tv_season
Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Season` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no season is found for the given id.
def tv_season(self, tv_id: int, season_number: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> Season: """ Gets the :class:`~tmdbapis.objs.reload.Movie` for the given id. Parameters: tv_id (int): TV ID of the show the contains the season you want. season_number (int): Season number to grab. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.Season` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no season is found for the given id. """ return Season(self, {"season_number": season_number}, tv_id, load=load, partial=partial)
(self, tv_id: int, season_number: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.Season
53,644
tmdbapis.tmdb
tv_show
Gets the :class:`~tmdbapis.objs.reload.TVShow` for the given id. Parameters: tv_id (int): TV ID of the show you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.TVShow` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id.
def tv_show(self, tv_id: int, load: bool = True, partial: Optional[Union[bool, str]] = False) -> TVShow: """ Gets the :class:`~tmdbapis.objs.reload.TVShow` for the given id. Parameters: tv_id (int): TV ID of the show you want. load (bool): Load the data on creation. partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. Returns: :class:`~tmdbapis.objs.reload.TVShow` Raises: :class:`~tmdbapis.exceptions.NotFound`: When no keyword is found for the given id. """ return TVShow(self, {"id": tv_id}, load=load, partial=partial)
(self, tv_id: int, load: bool = True, partial: Union[bool, str, NoneType] = False) -> tmdbapis.objs.reload.TVShow
53,645
tmdbapis.tmdb
tv_show_recommendations
Paginated Object of your personal TV show recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` - ``first_air_date.desc`` * - ``name.asc`` - ``name.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.reload.TVShowRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def tv_show_recommendations(self, sort_by: Optional[str] = None): """ Paginated Object of your personal TV show recommendations. (V4 Lists Only) Parameters: sort_by (Optional[str]): How the results are sorted. .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` - ``first_air_date.desc`` * - ``name.asc`` - ``name.desc`` * - ``vote_average.asc`` - ``vote_average.desc`` Returns: :class:`~tmdbapis.objs.reload.TVShowRecommendations` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return TVShowRecommendations(self, sort_by=sort_by)
(self, sort_by: Optional[str] = None)
53,646
tmdbapis.tmdb
tv_show_watchlist
Paginated Object of TV shows you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \* V4 Lists Only Returns: :class:`~tmdbapis.objs.reload.TVShowWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option.
def tv_show_watchlist(self, sort_by: Optional[str] = None, v3: bool = False): """ Paginated Object of TV shows you have added to your watchlist. Parameters: sort_by (Optional[str]): How the results are sorted. v3 (bool): Force List V3 Usage .. list-table:: Sort Options :header-rows: 0 * - ``created_at.asc`` - ``created_at.desc`` * - ``first_air_date.asc`` * - ``first_air_date.desc`` * * - ``name.asc`` * - ``name.desc`` * * - ``vote_average.asc`` * - ``vote_average.desc`` * \\* V4 Lists Only Returns: :class:`~tmdbapis.objs.reload.TVShowWatchlist` Raises: :class:`~tmdbapis.exceptions.Invalid`: When ``sort_by`` is not a valid option. """ return TVShowWatchlist(self, sort_by=sort_by, v3=v3)
(self, sort_by: Optional[str] = None, v3: bool = False)
53,647
tmdbapis.tmdb
upcoming_movies
Paginated Object of Upcoming Movies. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.UpcomingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid.
def upcoming_movies(self, region: Optional[Union[Country, str]] = None) -> UpcomingMovies: """ Paginated Object of Upcoming Movies. Parameters: region (Optional[Union[Country, str]]): ISO 3166-1 Alpha-2 Country Code or :class:`tmdbapis.objs.simple.Country` Object to narrow the search to only look for theatrical release dates within the specified country. Returns: :class:`~tmdbapis.objs.pagination.UpcomingMovies` Raises: :class:`~tmdbapis.exceptions.Invalid`: When the Country provided is not valid. """ return UpcomingMovies(self, region=self._validate_country(region))
(self, region: Union[tmdbapis.objs.simple.Country, str, NoneType] = None) -> tmdbapis.objs.pagination.UpcomingMovies
53,648
tmdbapis.tmdb
v4_access
Use this method to set up TMDb's V4 API To gain read access to TMDb V4's API just provide you're TMDb V4 Access Token either with this method or by using the ``v4_access_token`` Parameter of the :class:`~tmdbapis.tmdb.TMDbAPIs` constructor. To gain write access to TMDb V4's API 1. Gain Read Access 2. Authenticate the URL returned from :meth:`v4_authenticate`. 3. Approve the authentication using :meth:`v4_approved`. To get you're TMDb V3 Write Access Token use :attr:`TMDbAPIs.v4_access_token` After it's been approved. Parameters: access_token (str): TMDb V4 Access Token
def v4_access(self, access_token: str): """ Use this method to set up TMDb's V4 API To gain read access to TMDb V4's API just provide you're TMDb V4 Access Token either with this method or by using the ``v4_access_token`` Parameter of the :class:`~tmdbapis.tmdb.TMDbAPIs` constructor. To gain write access to TMDb V4's API 1. Gain Read Access 2. Authenticate the URL returned from :meth:`v4_authenticate`. 3. Approve the authentication using :meth:`v4_approved`. To get you're TMDb V3 Write Access Token use :attr:`TMDbAPIs.v4_access_token` After it's been approved. Parameters: access_token (str): TMDb V4 Access Token """ self._api4 = API4(access_token, session=self._session) self._api._api4 = self._api4
(self, access_token: str)
53,649
tmdbapis.tmdb
v4_approved
Use this method once the URL from :meth:`v4_authenticate` has been authenticated to gain write access to TMDb V4 API
def v4_approved(self): """ Use this method once the URL from :meth:`v4_authenticate` has been authenticated to gain write access to TMDb V4 API """ if not self._request_token: raise Authentication("Requires V4 Authentication, use tmdbapis.v4_authenticate() and approve the returned URL") self._v4_check().auth_create_access_token(self._request_token)
(self)
53,650
tmdbapis.tmdb
v4_authenticate
Use this method to get the authentication URL for write access to TMDb V4 API
def v4_authenticate(self): """ Use this method to get the authentication URL for write access to TMDb V4 API """ self._request_token = self._v4_check().auth_create_request_token()["request_token"] return f"https://www.themoviedb.org/auth/access?request_token={self._request_token}"
(self)
53,651
tmdbapis.exceptions
TMDbException
Base class for all TMDbAPIs exceptions.
class TMDbException(Exception): """ Base class for all TMDbAPIs exceptions. """ pass
null
53,652
tmdbapis.objs.image
TMDbImage
Represents a single Image. Attributes: aspect_ratio (float): Image Aspect Ratio. file_path (str): Image Path. file_type (str): File type of the Image. height (int): Image Height. id (str): Image ID. iso_639_1 (str): ISO 639-1 Language Code of the Image. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. url (str): Image Full URL. width (int): Image Width. vote_average (float): Image Vote Average. vote_count (int): Image Vote Count.
class TMDbImage(TMDbObj): """ Represents a single Image. Attributes: aspect_ratio (float): Image Aspect Ratio. file_path (str): Image Path. file_type (str): File type of the Image. height (int): Image Height. id (str): Image ID. iso_639_1 (str): ISO 639-1 Language Code of the Image. language (:class:`~tmdbapis.objs.simple.Language`): Language object for the ISO 639-1 Language Code. url (str): Image Full URL. width (int): Image Width. vote_average (float): Image Vote Average. vote_count (int): Image Vote Count. """ def __init__(self, tmdb, data, image_type): super().__init__(tmdb, data) self._image_type = image_type def _load(self, data): super()._load(data) self.aspect_ratio = self._parse(attrs="aspect_ratio", value_type="float") self.file_path = self._parse(attrs="file_path") self.file_type = self._parse(attrs="file_type") self.height = self._parse(attrs="height", value_type="int") self.id = self._parse(attrs="id", value_type="str") self.iso_639_1 = self._parse(attrs="iso_639_1") self.language = self._tmdb._get_object(self._data, "language") self.url = self._image_url(self.file_path) self.vote_average = self._parse(attrs="vote_average", value_type="float") self.vote_count = self._parse(attrs="vote_count", value_type="int") self.width = self._parse(attrs="width", value_type="int") self._finish(self.file_path) def __str__(self): return f"[{self._image_type}:{self.file_path}]"
(tmdb, data, image_type)
53,656
tmdbapis.objs.image
__init__
null
def __init__(self, tmdb, data, image_type): super().__init__(tmdb, data) self._image_type = image_type
(self, tmdb, data, image_type)
53,664
tmdbapis.objs.reload
TMDbReload
Base object for objects that Reload.
class TMDbReload(TMDbObj): """ Base object for objects that Reload. """ def __init__(self, tmdb, data, load=False, partial=False): super().__init__(tmdb, data) if load: self.reload(partial=partial) @abstractmethod def _load(self, data, partial=False): self._partial = data is not None or partial is not False super()._load(self._append_load(partial=partial) if data is None else data) def _append_str(self): return None def _append_load(self, partial=False): return self._full_load(partial=self._append_str() if partial is False else partial) @abstractmethod def _full_load(self, partial=None): """ Abstract Full Load """ def reload(self, partial: Optional[Union[bool, str]] = False): """ Reloads the object. Parameters: partial (Optional[Union[bool, str]]): leave False for a full load otherwise specify the endpoints you want added. """ self._load(None, partial=partial)
(tmdb, data, load=False, partial=False)