Skip to content

Trending

Bases: TMDB

Trending functionality.

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

Source code in src/tmdb_client_py/find.py
 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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
class Trending(TMDB):
    """
    Trending functionality.

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

    BASE_PATH = "trending"
    URLS = {
        "info": "/{media_type}/{time_window}",
    }

    def __init__(self, media_type="all", time_window="day"):
        super().__init__()
        self.media_type = media_type
        self.time_window = time_window

    def info(self, **kwargs):
        """
        Get the daily or weekly trending items. The daily trending list tracks
        items over the period of a day while items have a 24 hour half life.
        The weekly list tracks items over a 7 day period, with a 7 day half
        life.

        Valid Media Types
            'all': Include all movies, TV shows and people in the results as a
                   global trending list.
            'movie': Show the trending movies in the results.
            'tv': Show the trending TV shows in the results.
            'people': Show the trending people in the results.

        Valid Time Windows
            'day': View the trending list for the day.
            'week': View the trending list for the week.

        Args:
            None

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

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

    def _get_media_type_time_window_path(self, key):
        return self._get_path(key).format(
            media_type=self.media_type, time_window=self.time_window
        )

info(**kwargs)

Get the daily or weekly trending items. The daily trending list tracks items over the period of a day while items have a 24 hour half life. The weekly list tracks items over a 7 day period, with a 7 day half life.

Valid Media Types 'all': Include all movies, TV shows and people in the results as a global trending list. 'movie': Show the trending movies in the results. 'tv': Show the trending TV shows in the results. 'people': Show the trending people in the results.

Valid Time Windows 'day': View the trending list for the day. 'week': View the trending list for the week.

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/find.py
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
def info(self, **kwargs):
    """
    Get the daily or weekly trending items. The daily trending list tracks
    items over the period of a day while items have a 24 hour half life.
    The weekly list tracks items over a 7 day period, with a 7 day half
    life.

    Valid Media Types
        'all': Include all movies, TV shows and people in the results as a
               global trending list.
        'movie': Show the trending movies in the results.
        'tv': Show the trending TV shows in the results.
        'people': Show the trending people in the results.

    Valid Time Windows
        'day': View the trending list for the day.
        'week': View the trending list for the week.

    Args:
        None

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

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