/usr/lib/python2.7/dist-packages/tmdbsimple/discover.py is in python-tmdbsimple 2.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | # -*- coding: utf-8 -*-
"""
tmdbsimple.discover
~~~~~~~~~~~~~~~~~~~
This module implements the Discover functionality of tmdbsimple.
Created by Celia Oakley on 2013-10-31.
:copyright: (c) 2013-2018 by Celia Oakley
:license: GPLv3, see LICENSE for more details
"""
from .base import TMDB
class Discover(TMDB):
"""
Discover functionality.
See: https://developers.themoviedb.org/3/discover
"""
BASE_PATH = 'discover'
URLS = {
'movie': '/movie',
'tv': '/tv',
}
def movie(self, **kwargs):
"""
Discover movies by different types of data like average rating,
number of votes, genres and certifications.
Args:
page: (optional) Minimum 1, maximum 1000.
language: (optional) ISO 639-1 code.
sort_by: (optional) Available options are 'vote_average.desc',
'vote_average.asc', 'release_date.desc', 'release_date.asc'
'popularity.desc', 'popularity.asc'.
include_adult: (optional) Toggle the inclusion of adult titles.
Expected value is a boolean, True or False.
year: (optional) Filter the results release dates to matches that
include this value. Expected value is a year.
primary_release_year: (optional) Filter the results so that
only the primary release date year has
this value. Expected value is a year.
vote_count.gte or vote_count_gte: (optional) Only include movies
that are equal to, or have a vote count higher
than this value. Expected value is an integer.
vote_average.gte or vote_average_gte: (optional) Only include
movies that are equal to, or have a higher
average rating than this value. Expected value
is a float.
with_genres: (optional) Only include movies with the specified
genres. Expected value is an integer (the id of
a genre). Multiple values can be specified.
Comma separated indicates an 'AND' query, while
a pipe (|) separated value indicates an 'OR'.
release_date.gte or release_date_gte: (optional) The minimum
release to include. Expected format is
'YYYY-MM-DD'.
releaste_date.lte or release_date_lte: (optional) The maximum
release to include. Expected format is
'YYYY-MM-DD'.
certification_country: (optional) Only include movies with
certifications for a specific country. When
this value is specified, 'certification.lte'
is required. An ISO 3166-1 is expected.
certification.lte or certification_lte: (optional) Only include
movies with this certification and lower.
Expected value is a valid certification for
the specified 'certification_country'.
with_companies: (optional) Filter movies to include a specific
company. Expected value is an integer (the id
of a company). They can be comma separated
to indicate an 'AND' query.
Returns:
A dict respresentation of the JSON returned from the API.
"""
# Periods are not allowed in keyword arguments but several API
# arguments contain periods. See both usages in tests/test_discover.py.
for param in kwargs:
if '_lte' in param:
kwargs[param.replace('_lte', '.lte')] = kwargs.pop(param)
if '_gte' in param:
kwargs[param.replace('_gte', '.gte')] = kwargs.pop(param)
path = self._get_path('movie')
response = self._GET(path, kwargs)
self._set_attrs_to_values(response)
return response
def tv(self, **kwargs):
"""
Discover TV shows by different types of data like average rating,
number of votes, genres, the network they aired on and air dates.
Args:
page: (optional) Minimum 1, maximum 1000.
language: (optional) ISO 639-1 code.
sort_by: (optional) Available options are 'vote_average.desc',
'vote_average.asc', 'first_air_date.desc',
'first_air_date.asc', 'popularity.desc', 'popularity.asc'
first_air_year: (optional) Filter the results release dates to
matches that include this value. Expected value
is a year.
vote_count.gte or vote_count_gte: (optional) Only include TV shows
that are equal to,
or have vote count higher than this value. Expected
value is an integer.
vote_average.gte or vote_average_gte: (optional) Only include TV
shows that are equal
to, or have a higher average rating than this
value. Expected value is a float.
with_genres: (optional) Only include TV shows with the specified
genres. Expected value is an integer (the id of a
genre). Multiple valued can be specified. Comma
separated indicates an 'AND' query, while a
pipe (|) separated value indicates an 'OR'.
with_networks: (optional) Filter TV shows to include a specific
network. Expected value is an integer (the id of a
network). They can be comma separated to indicate an
'AND' query.
first_air_date.gte or first_air_date_gte: (optional) The minimum
release to include.
Expected format is 'YYYY-MM-DD'.
first_air_date.lte or first_air_date_lte: (optional) The maximum
release to include.
Expected format is 'YYYY-MM-DD'.
Returns:
A dict respresentation of the JSON returned from the API.
"""
# Periods are not allowed in keyword arguments but several API
# arguments contain periods. See both usages in tests/test_discover.py.
for param in kwargs:
if '_lte' in param:
kwargs[param.replace('_lte', '.lte')] = kwargs.pop(param)
if '_gte' in param:
kwargs[param.replace('_gte', '.gte')] = kwargs.pop(param)
path = self._get_path('tv')
response = self._GET(path, kwargs)
self._set_attrs_to_values(response)
return response
|