Skip to content

Genres

Bases: TMDB

Genres functionality.

See: https://developers.themoviedb.org/3/genres

Source code in src/tmdb_client_py/genres.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
class Genres(TMDB):
    """
    Genres functionality.

    See: https://developers.themoviedb.org/3/genres
    """

    BASE_PATH = "genre"
    URLS = {
        "movie_list": "/movie/list",
        "tv_list": "/tv/list",
        "movies": "/{id}/movies",  # backward compatibility
    }

    def __init__(self, id=0):
        super().__init__()
        self.id = id

    def movie_list(self, **kwargs):
        """
        Get the list of official genres for movies.

        Args:
            language: (optional) ISO 639-1 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_path("movie_list")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def tv_list(self, **kwargs):
        """
        Get the list of official genres for TV shows.

        Args:
            language: (optional) ISO 639-1 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_path("tv_list")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    # backward compatibility
    def movies(self, **kwargs):
        """
        Get the list of movies for a particular genre by id. By default, only
        movies with 10 or more votes are included.

        Args:
            page: (optional) Minimum 1, maximum 1000.
            language: (optional) ISO 639-1 code.
            include_all_movies: (optional) Toggle the inclusion of all movies
                                and not just those with 10 or more ratings.
                                Expected value is: True or False.
            include_adult: (optional) Toggle the inclusion of adult titles.
                           Expected value is: True or False.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_id_path("movies")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

movie_list(**kwargs)

Get the list of official genres for movies.

Parameters:

Name Type Description Default
language

(optional) ISO 639-1 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/genres.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
def movie_list(self, **kwargs):
    """
    Get the list of official genres for movies.

    Args:
        language: (optional) ISO 639-1 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_path("movie_list")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

movies(**kwargs)

Get the list of movies for a particular genre by id. By default, only movies with 10 or more votes are included.

Parameters:

Name Type Description Default
page

(optional) Minimum 1, maximum 1000.

required
language

(optional) ISO 639-1 code.

required
include_all_movies

(optional) Toggle the inclusion of all movies and not just those with 10 or more ratings. Expected value is: True or False.

required
include_adult

(optional) Toggle the inclusion of adult titles. Expected value is: True or False.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/genres.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
def movies(self, **kwargs):
    """
    Get the list of movies for a particular genre by id. By default, only
    movies with 10 or more votes are included.

    Args:
        page: (optional) Minimum 1, maximum 1000.
        language: (optional) ISO 639-1 code.
        include_all_movies: (optional) Toggle the inclusion of all movies
                            and not just those with 10 or more ratings.
                            Expected value is: True or False.
        include_adult: (optional) Toggle the inclusion of adult titles.
                       Expected value is: True or False.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_id_path("movies")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

tv_list(**kwargs)

Get the list of official genres for TV shows.

Parameters:

Name Type Description Default
language

(optional) ISO 639-1 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/genres.py
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
def tv_list(self, **kwargs):
    """
    Get the list of official genres for TV shows.

    Args:
        language: (optional) ISO 639-1 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_path("tv_list")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response