|
@ -14,6 +14,7 @@ Created by Celia Oakley on 2013-10-31. |
|
|
|
|
|
|
|
|
from .base import TMDB |
|
|
from .base import TMDB |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Movies(TMDB): |
|
|
class Movies(TMDB): |
|
|
""" |
|
|
""" |
|
|
Movies functionality. |
|
|
Movies functionality. |
|
@ -23,27 +24,28 @@ class Movies(TMDB): |
|
|
BASE_PATH = 'movie' |
|
|
BASE_PATH = 'movie' |
|
|
URLS = { |
|
|
URLS = { |
|
|
'info': '/{id}', |
|
|
'info': '/{id}', |
|
|
|
|
|
'account_states': '/{id}/account_states', |
|
|
'alternative_titles': '/{id}/alternative_titles', |
|
|
'alternative_titles': '/{id}/alternative_titles', |
|
|
|
|
|
'changes': '/{id}/changes', |
|
|
'credits': '/{id}/credits', |
|
|
'credits': '/{id}/credits', |
|
|
'external_ids': '/{id}/external_ids', |
|
|
'external_ids': '/{id}/external_ids', |
|
|
'images': '/{id}/images', |
|
|
'images': '/{id}/images', |
|
|
'keywords': '/{id}/keywords', |
|
|
'keywords': '/{id}/keywords', |
|
|
'release_dates': '/{id}/release_dates', |
|
|
'release_dates': '/{id}/release_dates', |
|
|
'releases': '/{id}/releases', |
|
|
|
|
|
'videos': '/{id}/videos', |
|
|
'videos': '/{id}/videos', |
|
|
'translations': '/{id}/translations', |
|
|
'translations': '/{id}/translations', |
|
|
|
|
|
'recommendations': '/{id}/recommendations', |
|
|
'similar_movies': '/{id}/similar_movies', |
|
|
'similar_movies': '/{id}/similar_movies', |
|
|
'reviews': '/{id}/reviews', |
|
|
'reviews': '/{id}/reviews', |
|
|
'lists': '/{id}/lists', |
|
|
'lists': '/{id}/lists', |
|
|
'changes': '/{id}/changes', |
|
|
'rating': '/{id}/rating', |
|
|
|
|
|
'rating_delete': '/{id}/rating', |
|
|
'latest': '/latest', |
|
|
'latest': '/latest', |
|
|
'upcoming': '/upcoming', |
|
|
|
|
|
'now_playing': '/now_playing', |
|
|
'now_playing': '/now_playing', |
|
|
'popular': '/popular', |
|
|
'popular': '/popular', |
|
|
'top_rated': '/top_rated', |
|
|
'top_rated': '/top_rated', |
|
|
'account_states': '/{id}/account_states', |
|
|
'upcoming': '/upcoming', |
|
|
'rating': '/{id}/rating', |
|
|
'releases': '/{id}/releases', # backward compatability |
|
|
'recommendations': '/{id}/recommendations' |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, id=0): |
|
|
def __init__(self, id=0): |
|
@ -52,11 +54,15 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def info(self, **kwargs): |
|
|
def info(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the basic movie information for a specific movie id. |
|
|
Get the primary information about a movie. |
|
|
|
|
|
|
|
|
|
|
|
Supports append_to_response. Read more about this at |
|
|
|
|
|
https://developers.themoviedb.org/3/getting-started/append-to-response. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
append_to_response: (optional) Append requests within the same |
|
|
|
|
|
namespace to the response. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -67,13 +73,32 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def account_states(self, **kwargs): |
|
|
|
|
|
""" |
|
|
|
|
|
Grab the following account states for a session: |
|
|
|
|
|
- Movie rating |
|
|
|
|
|
- If it belongs to your watchlist |
|
|
|
|
|
- If it belongs to your favourite list |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
session_id: (required) See Authentication. |
|
|
|
|
|
guest_session_id: (optional) See Authentication. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
|
|
|
path = self._get_id_path('account_states') |
|
|
|
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
|
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
def alternative_titles(self, **kwargs): |
|
|
def alternative_titles(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the alternative titles for a specific movie id. |
|
|
Get all of the alternative titles for a movie. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
country: (optional) ISO 3166-1 code. |
|
|
country: (optional) ISO 3166-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -84,12 +109,35 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def changes(self, **kwargs): |
|
|
|
|
|
""" |
|
|
|
|
|
Get the changes for a movie. By default only the last 24 hours are returned. |
|
|
|
|
|
|
|
|
|
|
|
You can query up to 14 days in a single query by using the start_date |
|
|
|
|
|
and end_date query parameters. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
start_date: (optional) Filter the results with a start date. |
|
|
|
|
|
Expected format is 'YYYY-MM-DD'. |
|
|
|
|
|
end_date: (optional) Filter the results with a end date. |
|
|
|
|
|
Expected format is 'YYYY-MM-DD'. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
|
|
|
path = self._get_id_path('changes') |
|
|
|
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
|
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
def credits(self, **kwargs): |
|
|
def credits(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the cast and crew information for a specific movie id. |
|
|
Get the cast and crew for a movie. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -102,11 +150,14 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def external_ids(self, **kwargs): |
|
|
def external_ids(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the external ids for a specific movie id. |
|
|
Get the external ids for a movie. We currently support the following |
|
|
|
|
|
external sources. |
|
|
|
|
|
|
|
|
|
|
|
Media Databases - IMDb |
|
|
|
|
|
Social IDs - Facebok, Instagram, Twitter |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
language: (optional) ISO 639-1 code. |
|
|
None |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -119,11 +170,16 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def images(self, **kwargs): |
|
|
def images(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the images (posters and backdrops) for a specific movie id. |
|
|
Get the images that belong to a movie. |
|
|
|
|
|
|
|
|
|
|
|
Querying images with a language parameter will filter the results. If |
|
|
|
|
|
you want to include a fallback language (especially useful for |
|
|
|
|
|
backdrops) you can use the include_image_language parameter. This |
|
|
|
|
|
should be a comma seperated value like so: |
|
|
|
|
|
include_image_language=en,null. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
include_image_language: (optional) Comma separated, a valid |
|
|
include_image_language: (optional) Comma separated, a valid |
|
|
ISO 69-1. |
|
|
ISO 69-1. |
|
|
|
|
|
|
|
@ -138,7 +194,10 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def keywords(self): |
|
|
def keywords(self): |
|
|
""" |
|
|
""" |
|
|
Get the plot keywords for a specific movie id. |
|
|
Get the keywords that have been added to a movie. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -149,29 +208,21 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def recommendations(self, **kwargs): |
|
|
def release_dates(self, **kwargs): |
|
|
""" |
|
|
|
|
|
Get a list of recommended movies for a movie. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('recommendations') |
|
|
Get the release date along with the certification for a movie. |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
Release dates support different types: |
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def release_dates(self, **kwargs): |
|
|
1. Premiere |
|
|
""" |
|
|
2. Theatrical (limited) |
|
|
Get the release dates and certification for a specific movie id. |
|
|
3. Theatrical |
|
|
|
|
|
4. Digital |
|
|
|
|
|
5. Physical |
|
|
|
|
|
6. TV |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -182,51 +233,50 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def releases(self, **kwargs): |
|
|
def videos(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the release date and certification information by country for a |
|
|
Get the videos that have been added to a movie. |
|
|
specific movie id. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('releases') |
|
|
path = self._get_id_path('videos') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def videos(self, **kwargs): |
|
|
def translations(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the videos (trailers, teasers, clips, etc...) for a |
|
|
Get a list of translations that have been created for a movie. |
|
|
specific movie id. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('videos') |
|
|
path = self._get_id_path('translations') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def translations(self, **kwargs): |
|
|
def recommendations(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the translations for a specific movie id. |
|
|
Get a list of recommended movies for a movie. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('translations') |
|
|
path = self._get_id_path('recommendations') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
@ -234,12 +284,14 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def similar_movies(self, **kwargs): |
|
|
def similar_movies(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the similar movies for a specific movie id. |
|
|
Get a list of similar movies. This is not the same as the |
|
|
|
|
|
"Recommendation" system you see on the website. |
|
|
|
|
|
|
|
|
|
|
|
These items are assembled by looking at keywords and genres. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -252,12 +304,11 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def reviews(self, **kwargs): |
|
|
def reviews(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the reviews for a particular movie id. |
|
|
Get the user reviews for a movie. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -270,12 +321,11 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def lists(self, **kwargs): |
|
|
def lists(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the lists that the movie belongs to. |
|
|
Get a list of lists that this movie belongs to. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -286,54 +336,70 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def changes(self, **kwargs): |
|
|
def rating(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the changes for a specific movie id. |
|
|
Rate a movie. |
|
|
|
|
|
|
|
|
Changes are grouped by key, and ordered by date in descending order. |
|
|
A valid session or guest session ID is required. You can read more |
|
|
By default, only the last 24 hours of changes are returned. The |
|
|
about how this works at |
|
|
maximum number of days that can be returned in a single request is 14. |
|
|
https://developers.themoviedb.org/3/authentication/how-do-i-generate-a-session-id. |
|
|
The language is present on fields that are translatable. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
start_date: (optional) Expected format is 'YYYY-MM-DD'. |
|
|
session_id: (optional) See Authentication. |
|
|
end_date: (optional) Expected format is 'YYYY-MM-DD'. |
|
|
guest_session_id: (optional) See Authentication. |
|
|
|
|
|
value: (required) This is the value of the rating you want to |
|
|
|
|
|
submit. The value is expected to be between 0.5 and 10.0. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('changes') |
|
|
path = self._get_id_path('rating') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
payload = { |
|
|
|
|
|
'value': kwargs.pop('value', None), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response = self._POST(path, kwargs, payload) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def latest(self, **kwargs): |
|
|
def rating_delete(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the latest movie id. |
|
|
Remove your rating for a movie. |
|
|
|
|
|
|
|
|
|
|
|
A valid session or guest session ID is required. You can read more |
|
|
|
|
|
about how this works at |
|
|
|
|
|
https://developers.themoviedb.org/3/authentication/how-do-i-generate-a-session-id. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
session_id: (optional) See Authentication. |
|
|
|
|
|
guest_session_id: (optional) See Authentication. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_path('latest') |
|
|
path = self._get_id_path('rating_delete') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
payload = { |
|
|
|
|
|
'value': kwargs.pop('value', None), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response = self._DELETE(path, kwargs, payload) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def upcoming(self, **kwargs): |
|
|
def latest(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of upcoming movies. This list refreshes every day. |
|
|
Get the most newly created movie. This is a live response and will |
|
|
The maximum number of items this list will include is 100. |
|
|
continuously change. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_path('upcoming') |
|
|
path = self._get_path('latest') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
@ -341,12 +407,19 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def now_playing(self, **kwargs): |
|
|
def now_playing(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of movies playing in theatres. This list refreshes |
|
|
Get a list of movies in theatres. This is a release type query that |
|
|
every day. The maximum number of items this list will include is 100. |
|
|
looks for all movies that have a release type of 2 or 3 within the |
|
|
|
|
|
specified date range. |
|
|
|
|
|
|
|
|
|
|
|
You can optionally specify a region prameter which will narrow the |
|
|
|
|
|
search to only look for theatrical release dates within the specified |
|
|
|
|
|
country. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
region: (optional) Specify a ISO 3166-1 code to filter release |
|
|
|
|
|
dates. Must be uppercase. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -359,12 +432,14 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def popular(self, **kwargs): |
|
|
def popular(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of popular movies on The Movie Database. This list |
|
|
Get a list of the current popular movies on TMDb. This list updates |
|
|
refreshes every day. |
|
|
daily. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
region: (optional) Specify a ISO 3166-1 code to filter release |
|
|
|
|
|
dates. Must be uppercase. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -377,13 +452,13 @@ class Movies(TMDB): |
|
|
|
|
|
|
|
|
def top_rated(self, **kwargs): |
|
|
def top_rated(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of top rated movies. By default, this list will only |
|
|
Get the top rated movies on TMDb. |
|
|
include movies that have 10 or more votes. This list refreshes every |
|
|
|
|
|
day. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
region: (optional) Specify a ISO 3166-1 code to filter release |
|
|
|
|
|
dates. Must be uppercase. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -394,44 +469,46 @@ class Movies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def account_states(self, **kwargs): |
|
|
def upcoming(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
This method lets users get the status of whether or not the movie has |
|
|
Get a list of upcoming movies in theatres. This is a release type query |
|
|
been rated or added to their favourite or watch lists. A valid session |
|
|
that looks for all movies that have a release type of 2 or 3 within the |
|
|
id is required. |
|
|
specified date range. |
|
|
|
|
|
|
|
|
|
|
|
You can optionally specify a region prameter which will narrow the |
|
|
|
|
|
search to only look for theatrical release dates within the specified |
|
|
|
|
|
country. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
session_id: see Authentication. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
page: (optional) Minimum 1, maximum 1000, default 1. |
|
|
|
|
|
region: (optional) Specify a ISO 3166-1 code to filter release |
|
|
|
|
|
dates. Must be uppercase. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('account_states') |
|
|
path = self._get_path('upcoming') |
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
def rating(self, **kwargs): |
|
|
# backward compatability |
|
|
|
|
|
def releases(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
This method lets users rate a movie. A valid session id or guest |
|
|
Get the release date and certification information by country for a |
|
|
session id is required. |
|
|
specific movie id. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
session_id: see Authentication. |
|
|
None |
|
|
guest_session_id: see Authentication. |
|
|
|
|
|
value: Rating value. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|
""" |
|
|
""" |
|
|
path = self._get_id_path('rating') |
|
|
path = self._get_id_path('releases') |
|
|
|
|
|
|
|
|
payload = { |
|
|
|
|
|
'value': kwargs.pop('value', None), |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response = self._POST(path, kwargs, payload) |
|
|
response = self._GET(path, kwargs) |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
@ -446,6 +523,7 @@ class Collections(TMDB): |
|
|
URLS = { |
|
|
URLS = { |
|
|
'info': '/{id}', |
|
|
'info': '/{id}', |
|
|
'images': '/{id}/images', |
|
|
'images': '/{id}/images', |
|
|
|
|
|
'translations': '/{id}/translations', |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, id): |
|
|
def __init__(self, id): |
|
@ -454,16 +532,10 @@ class Collections(TMDB): |
|
|
|
|
|
|
|
|
def info(self, **kwargs): |
|
|
def info(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the basic collection information for a specific collection id. |
|
|
Get collection details by id. |
|
|
You can get the ID needed for this method by making a /movie/{id} |
|
|
|
|
|
request and paying attention to the belongs_to_collection hash. |
|
|
|
|
|
|
|
|
|
|
|
Movie parts are not sorted in any particular order. If you would like |
|
|
|
|
|
to sort them yourself you can use the provided release_date. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -476,13 +548,10 @@ class Collections(TMDB): |
|
|
|
|
|
|
|
|
def images(self, **kwargs): |
|
|
def images(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get all of the images for a particular collection by collection id. |
|
|
Get the images for a collection by id. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
include_image_language: (optional) Comma separated, a valid |
|
|
|
|
|
ISO 69-1. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -493,6 +562,23 @@ class Collections(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def translations(self, **kwargs): |
|
|
|
|
|
""" |
|
|
|
|
|
Get a list of the translations for a collection by id. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
|
|
|
path = self._get_id_path('translations') |
|
|
|
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
|
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Companies(TMDB): |
|
|
class Companies(TMDB): |
|
|
""" |
|
|
""" |
|
|
Companies functionality. |
|
|
Companies functionality. |
|
@ -502,7 +588,9 @@ class Companies(TMDB): |
|
|
BASE_PATH = 'company' |
|
|
BASE_PATH = 'company' |
|
|
URLS = { |
|
|
URLS = { |
|
|
'info': '/{id}', |
|
|
'info': '/{id}', |
|
|
'movies': '/{id}/movies', |
|
|
'alternative_names': '/{id}/alternative_names', |
|
|
|
|
|
'images': '/{id}/images', |
|
|
|
|
|
'movies': '/{id}/movies', # backward compatability |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, id=0): |
|
|
def __init__(self, id=0): |
|
@ -511,11 +599,9 @@ class Companies(TMDB): |
|
|
|
|
|
|
|
|
def info(self, **kwargs): |
|
|
def info(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
This method is used to retrieve all of the basic information about a |
|
|
Get a companies details by id. |
|
|
company. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -526,14 +612,54 @@ class Companies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def alternative_names(self, **kwargs): |
|
|
|
|
|
""" |
|
|
|
|
|
Get the alternative names of a company. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
|
|
|
path = self._get_id_path('alternative_names') |
|
|
|
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
|
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
def images(self, **kwargs): |
|
|
|
|
|
""" |
|
|
|
|
|
Get a company's logos by id. |
|
|
|
|
|
|
|
|
|
|
|
There are two image formats that are supported for companies, PNG's and |
|
|
|
|
|
SVG's. You can see which type the original file is by looking at the |
|
|
|
|
|
file_type field. We prefer SVG's as they are resolution independent and |
|
|
|
|
|
as such, the width and height are only there to reflect the original |
|
|
|
|
|
asset that was uploaded. An SVG can be scaled properly beyond those |
|
|
|
|
|
dimensions if you call them as a PNG. |
|
|
|
|
|
|
|
|
|
|
|
For more information about how SVG's and PNG's can be used, take a read |
|
|
|
|
|
through https://developers.themoviedb.org/3/getting-started/images. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
|
A dict representation of the JSON returned from the API. |
|
|
|
|
|
""" |
|
|
|
|
|
path = self._get_id_path('images') |
|
|
|
|
|
|
|
|
|
|
|
response = self._GET(path, kwargs) |
|
|
|
|
|
self._set_attrs_to_values(response) |
|
|
|
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
# backward compatability |
|
|
def movies(self, **kwargs): |
|
|
def movies(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of movies associated with a particular company. |
|
|
Get the list of movies associated with a particular company. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
append_to_response: (optional) Comma separated, any movie method. |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -544,6 +670,7 @@ class Companies(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Keywords(TMDB): |
|
|
class Keywords(TMDB): |
|
|
""" |
|
|
""" |
|
|
Keywords functionality. |
|
|
Keywords functionality. |
|
@ -562,7 +689,10 @@ class Keywords(TMDB): |
|
|
|
|
|
|
|
|
def info(self, **kwargs): |
|
|
def info(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the basic information for a specific keyword id. |
|
|
Get the details of a keyword. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -575,11 +705,15 @@ class Keywords(TMDB): |
|
|
|
|
|
|
|
|
def movies(self, **kwargs): |
|
|
def movies(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the list of movies for a particular keyword by id. |
|
|
Get the movies that belong to a keyword. |
|
|
|
|
|
|
|
|
|
|
|
We highly recommend using movie discover instead of this method as it |
|
|
|
|
|
is much more flexible. |
|
|
|
|
|
|
|
|
Args: |
|
|
Args: |
|
|
page: (optional) Minimum value of 1. Expected value is an integer. |
|
|
|
|
|
language: (optional) ISO 639-1 code. |
|
|
language: (optional) ISO 639-1 code. |
|
|
|
|
|
include_adult: Choose whether to inlcude adult (pornography) |
|
|
|
|
|
content in the results. |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
@ -590,6 +724,7 @@ class Keywords(TMDB): |
|
|
self._set_attrs_to_values(response) |
|
|
self._set_attrs_to_values(response) |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Reviews(TMDB): |
|
|
class Reviews(TMDB): |
|
|
""" |
|
|
""" |
|
|
Reviews functionality. |
|
|
Reviews functionality. |
|
@ -607,7 +742,10 @@ class Reviews(TMDB): |
|
|
|
|
|
|
|
|
def info(self, **kwargs): |
|
|
def info(self, **kwargs): |
|
|
""" |
|
|
""" |
|
|
Get the full details of a review by ID. |
|
|
Get the review details by id. |
|
|
|
|
|
|
|
|
|
|
|
Args: |
|
|
|
|
|
None |
|
|
|
|
|
|
|
|
Returns: |
|
|
Returns: |
|
|
A dict representation of the JSON returned from the API. |
|
|
A dict representation of the JSON returned from the API. |
|
|