[Python-modules-commits] [python-tmdbsimple] 02/09: New upstream version 2.1.0

Michael Fladischer fladi at moszumanska.debian.org
Tue Jan 9 07:28:21 UTC 2018


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch debian/master
in repository python-tmdbsimple.

commit b436a3604bca28da09686402b0884d2e69c7d120
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Tue Jan 9 08:19:57 2018 +0100

    New upstream version 2.1.0
---
 README.rst                  |  2 +-
 setup.py                    |  4 ++--
 tests/__init__.py           |  2 +-
 tests/test_account.py       |  2 +-
 tests/test_base.py          | 52 +++++++++++++++++++++++++++++++++++++++++++++
 tests/test_changes.py       |  2 +-
 tests/test_configuration.py |  2 +-
 tests/test_discover.py      |  2 +-
 tests/test_find.py          |  2 +-
 tests/test_genres.py        | 11 +++++++---
 tests/test_movies.py        | 15 ++++++-------
 tests/test_people.py        |  2 +-
 tests/test_search.py        |  2 +-
 tests/test_tv.py            |  2 +-
 tmdbsimple/__init__.py      |  6 +++---
 tmdbsimple/account.py       |  2 +-
 tmdbsimple/base.py          |  4 ++--
 tmdbsimple/changes.py       |  2 +-
 tmdbsimple/configuration.py |  2 +-
 tmdbsimple/discover.py      |  2 +-
 tmdbsimple/find.py          |  2 +-
 tmdbsimple/genres.py        | 27 ++++++++++++++++++-----
 tmdbsimple/movies.py        | 42 +++++++++++++++++++++++++-----------
 tmdbsimple/people.py        |  2 +-
 tmdbsimple/search.py        |  2 +-
 tmdbsimple/tv.py            |  2 +-
 26 files changed, 144 insertions(+), 53 deletions(-)

diff --git a/README.rst b/README.rst
index 5166262..3e70e75 100644
--- a/README.rst
+++ b/README.rst
@@ -4,7 +4,7 @@ tmdbsimple
 A wrapper for The Movie Database API v3
 ---------------------------------------
 
-*tmdbsimple* is a wrapper, written in Python, for The Movie Database (TMDb) API v3.  By calling the functions available in *tmdbsimple* you can simplify your code and easily access a vast amount of movie, tv, and cast data.  To learn more about The Movie Database API, check out the overview page http://www.themoviedb.org/documentation/api and documentation page http://docs.themoviedb.apiary.io.
+*tmdbsimple* is a wrapper, written in Python, for The Movie Database (TMDb) API v3.  By calling the functions available in *tmdbsimple* you can simplify your code and easily access a vast amount of movie, tv, and cast data.  To learn more about The Movie Database API, check out the overview page http://www.themoviedb.org/documentation/api and documentation page https://developers.themoviedb.org/3.
 
 Features
 --------
diff --git a/setup.py b/setup.py
index 431ccd5..e21c3b0 100644
--- a/setup.py
+++ b/setup.py
@@ -11,14 +11,14 @@ def read(fname):
 # requests[security]: http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent/29202163#29202163
 setup(
     name = 'tmdbsimple',
-    version = '1.8.0',
+    version = '2.1.0',
     author = 'Celia Oakley',
     author_email = 'celia.oakley at alumni.stanford.edu',
     description = 'A Python wrapper for The Movie Database API v3',
     keywords = ['movie', 'the movie database', 'movie database', 'tmdb', 
                 'wrapper', 'database', 'themoviedb', 'moviedb', 'api'],
     url = 'https://github.com/celiao/tmdbsimple',
-    download_url = 'https://github.com/celiao/tmdbsimple/tarball/1.8.0',
+    download_url = 'https://github.com/celiao/tmdbsimple/tarball/2.1.0',
     packages = ['tmdbsimple'],
     long_description=read('README.rst'),
     install_requires = ['requests'],
diff --git a/tests/__init__.py b/tests/__init__.py
index a293d13..6eecae5 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -9,7 +9,7 @@ This test suite checks the methods of tmdbsimple.
 Use the following command to run all the tests:
     python -W ignore:ResourceWarning -m unittest discover tests
 
-:copyright: (c) 2013-2014 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_account.py b/tests/test_account.py
index 2c6d45f..d6f97e0 100644
--- a/tests/test_account.py
+++ b/tests/test_account.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Account class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_base.py b/tests/test_base.py
new file mode 100644
index 0000000..567bcc1
--- /dev/null
+++ b/tests/test_base.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+
+"""
+test_base.py
+~~~~~~~~~~~~~~~
+
+This test suite checks the methods of the TMDB class of tmdbsimple.
+
+Created by Celia Oakley on 2018-01-06
+
+:copyright: (c) 2018 by Celia Oakley.
+:license: GPLv3, see LICENSE for more details.
+"""
+
+import unittest
+import tmdbsimple as tmdb
+
+from tests import API_KEY, USERNAME, PASSWORD
+tmdb.API_KEY = API_KEY
+
+"""
+Constants
+"""
+MOVIE_ID = 103332
+MOVIEQUERY1 = 'Matrix'
+MOVIEQUERY2 = 'Star Wars'
+
+class TMDBTestCase(unittest.TestCase):
+    # We want to be able to call methods multiple times.
+    # If a method returns a dict with a key of the same name as the method,
+    # e.g., Movies.keywords(), an attribute won't be set.
+    # Confirm for this case that the method can be called again.
+    def test_tmdb_set_attrs_to_values_method_equals_attribute(self):
+        id = MOVIE_ID
+        movie = tmdb.Movies(id)
+        response = movie.keywords()
+        raised = False
+        try:
+            movie.keywords()
+        except:
+            raised = True
+        self.assertFalse(raised)
+
+    # Confirm for multiple calls to the same method with different arguments,
+    # that the attributes are updated.
+    def test_tmdb_set_attrs_to_values_attribute_multiple_calls(self):
+        search = tmdb.Search()
+        response = search.movie(query=MOVIEQUERY1)
+        title1 = search.results[0]['original_title']
+        response = search.movie(query=MOVIEQUERY2)
+        title2 = search.results[0]['original_title']
+        self.assertNotEqual(title1, title2)
diff --git a/tests/test_changes.py b/tests/test_changes.py
index c8b8c1d..21dc07a 100644
--- a/tests/test_changes.py
+++ b/tests/test_changes.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Changes class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_configuration.py b/tests/test_configuration.py
index e87e76a..887371b 100644
--- a/tests/test_configuration.py
+++ b/tests/test_configuration.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Configuration class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_discover.py b/tests/test_discover.py
index e678b26..f050624 100644
--- a/tests/test_discover.py
+++ b/tests/test_discover.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Discover class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_find.py b/tests/test_find.py
index e9036b1..ef1c1e5 100644
--- a/tests/test_find.py
+++ b/tests/test_find.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Find class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_genres.py b/tests/test_genres.py
index 5a64f42..73a0228 100644
--- a/tests/test_genres.py
+++ b/tests/test_genres.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Genres class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
@@ -25,9 +25,14 @@ GENRE_ID = 18
 
 
 class GenresTestCase(unittest.TestCase):
-    def test_genres_list(self):
+    def test_genres_movie_list(self):
         genre = tmdb.Genres()
-        response = genre.list()
+        response = genre.movie_list()
+        self.assertTrue(hasattr(genre, 'genres'))
+
+    def test_genres_tv_list(self):
+        genre = tmdb.Genres()
+        response = genre.tv_list()
         self.assertTrue(hasattr(genre, 'genres'))
 
     def test_genres_movies(self):
diff --git a/tests/test_movies.py b/tests/test_movies.py
index c3f9eba..e658b1e 100644
--- a/tests/test_movies.py
+++ b/tests/test_movies.py
@@ -7,7 +7,7 @@ This test suite checks the methods of the Movies class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
@@ -78,13 +78,6 @@ class MoviesTestCase(unittest.TestCase):
         movie = tmdb.Movies(id)
         response = movie.keywords()
         self.assertTrue(hasattr(movie, 'keywords'))
-        # Confirm we can call keywords() again without error
-        raised = False
-        try:
-            movie.keywords()
-        except:
-            raised = True
-        self.assertFalse(raised)
 
     def test_movies_release_dates(self):
         id = MOVIE_ID
@@ -116,6 +109,12 @@ class MoviesTestCase(unittest.TestCase):
         response = movie.similar_movies()
         self.assertTrue(hasattr(movie, 'results'))
 
+    def test_movies_recommendations(self):
+        id = MOVIE_ID
+        movie = tmdb.Movies(id)
+        response = movie.recommendations()
+        self.assertTrue(hasattr(movie, 'results'))
+
     def test_movies_reviews(self):
         id = MOVIE_ID
         movie = tmdb.Movies(id)
diff --git a/tests/test_people.py b/tests/test_people.py
index 7401636..505f920 100644
--- a/tests/test_people.py
+++ b/tests/test_people.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the People class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_search.py b/tests/test_search.py
index ab4eeec..2dd92f7 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Search class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tests/test_tv.py b/tests/test_tv.py
index f091de3..7612e5e 100644
--- a/tests/test_tv.py
+++ b/tests/test_tv.py
@@ -8,7 +8,7 @@ This test suite checks the methods of the Test class of tmdbsimple.
 
 Created by Celia Oakley on 2013-11-05
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details.
 """
 
diff --git a/tmdbsimple/__init__.py b/tmdbsimple/__init__.py
index 603cca8..c748e7a 100644
--- a/tmdbsimple/__init__.py
+++ b/tmdbsimple/__init__.py
@@ -12,14 +12,14 @@ http://www.themoviedb.org/documentation/api and documentation page
 https://developers.themoviedb.org/3/getting-started
 https://www.themoviedb.org/documentation/api/status-codes
 
-:copyright: (c) 2013-2017 by Celia Oakley.
+:copyright: (c) 2013-2018 by Celia Oakley.
 :license: GPLv3, see LICENSE for more details
 """
 
 __title__ = 'tmdbsimple'
-__version__ = '1.8.0'
+__version__ = '2.1.0'
 __author__ = 'Celia Oakley'
-__copyright__ = 'Copyright (c) 2013-2017 Celia Oakley'
+__copyright__ = 'Copyright (c) 2013-2018 Celia Oakley'
 __license__ = 'GPLv3'
 
 import os
diff --git a/tmdbsimple/account.py b/tmdbsimple/account.py
index caa24eb..75e5877 100644
--- a/tmdbsimple/account.py
+++ b/tmdbsimple/account.py
@@ -8,7 +8,7 @@ of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/base.py b/tmdbsimple/base.py
index 4cccc19..d178f66 100644
--- a/tmdbsimple/base.py
+++ b/tmdbsimple/base.py
@@ -7,7 +7,7 @@ This module implements the base class of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
@@ -102,6 +102,6 @@ class TMDB(object):
         """
         if isinstance(response, dict):
             for key in response.keys():
-                if not hasattr(self, key):
+                if not hasattr(self, key) or not callable(getattr(self, key)):
                     setattr(self, key, response[key])
 
diff --git a/tmdbsimple/changes.py b/tmdbsimple/changes.py
index a789dd6..c910421 100644
--- a/tmdbsimple/changes.py
+++ b/tmdbsimple/changes.py
@@ -7,7 +7,7 @@ This module implements the Changes functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/configuration.py b/tmdbsimple/configuration.py
index c899452..eca1062 100644
--- a/tmdbsimple/configuration.py
+++ b/tmdbsimple/configuration.py
@@ -9,7 +9,7 @@ functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/discover.py b/tmdbsimple/discover.py
index 95652ea..2ca55aa 100644
--- a/tmdbsimple/discover.py
+++ b/tmdbsimple/discover.py
@@ -7,7 +7,7 @@ This module implements the Discover functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/find.py b/tmdbsimple/find.py
index 7e51741..3416702 100644
--- a/tmdbsimple/find.py
+++ b/tmdbsimple/find.py
@@ -7,7 +7,7 @@ This module implements the Find functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/genres.py b/tmdbsimple/genres.py
index 5ac6a62..e8fa94b 100644
--- a/tmdbsimple/genres.py
+++ b/tmdbsimple/genres.py
@@ -7,7 +7,7 @@ This module implements the Genres functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2014 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
@@ -22,7 +22,8 @@ class Genres(TMDB):
     """
     BASE_PATH = 'genre'
     URLS = {
-        'list': '/list',
+        'movie_list': '/movie/list',
+        'tv_list': '/tv/list',
         'movies': '/{id}/movies',
     }
 
@@ -30,9 +31,9 @@ class Genres(TMDB):
         super(Genres, self).__init__()
         self.id = id
 
-    def list(self, **kwargs):
+    def movie_list(self, **kwargs):
         """
-        Get the list of genres.
+        Get the list of Movie genres.
 
         Args:
             language: (optional) ISO 639-1 code.
@@ -40,7 +41,23 @@ class Genres(TMDB):
         Returns:
             A dict respresentation of the JSON returned from the API.
         """
-        path = self._get_path('list')
+        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 TV genres.
+
+        Args:
+            language: (optional) ISO 639-1 code.
+
+        Returns:
+            A dict respresentation of the JSON returned from the API.
+        """
+        path = self._get_path('tv_list')
 
         response = self._GET(path, kwargs)
         self._set_attrs_to_values(response)
diff --git a/tmdbsimple/movies.py b/tmdbsimple/movies.py
index 18cb3e2..5e91109 100644
--- a/tmdbsimple/movies.py
+++ b/tmdbsimple/movies.py
@@ -8,7 +8,7 @@ Reviews functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
@@ -42,6 +42,7 @@ class Movies(TMDB):
         'top_rated': '/top_rated',
         'account_states': '/{id}/account_states',
         'rating': '/{id}/rating',
+        'recommendations': '/{id}/recommendations'
     }
 
     def __init__(self, id=0):
@@ -130,21 +131,38 @@ class Movies(TMDB):
         self._set_attrs_to_values(response)
         return response
 
+    def recommendations(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 respresentation of the JSON returned from the API.
+        """
+        path = self._get_id_path('recommendations')
+
+        response = self._GET(path, kwargs)
+        self._set_attrs_to_values(response)
+        return response
+
     def release_dates(self, **kwargs):
-         """
-         Get the release dates and certification for a specific movie id.
+        """
+        Get the release dates and certification for a specific movie id.
 
-         Args:
-             append_to_response: (optional) Comma separated, any movie method.
+        Args:
+            append_to_response: (optional) Comma separated, any movie method.
 
-         Returns:
-             A dict respresentation of the JSON returned from the API.
-         """
-         path = self._get_id_path('release_dates')
+        Returns:
+            A dict respresentation of the JSON returned from the API.
+        """
+        path = self._get_id_path('release_dates')
 
-         response = self._GET(path, kwargs)
-         self._set_attrs_to_values(response)
-         return response
+        response = self._GET(path, kwargs)
+        self._set_attrs_to_values(response)
+        return response
 
     def releases(self, **kwargs):
         """
diff --git a/tmdbsimple/people.py b/tmdbsimple/people.py
index e4b249f..e4f8991 100644
--- a/tmdbsimple/people.py
+++ b/tmdbsimple/people.py
@@ -8,7 +8,7 @@ of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/search.py b/tmdbsimple/search.py
index 2a1c252..2bece4c 100644
--- a/tmdbsimple/search.py
+++ b/tmdbsimple/search.py
@@ -7,7 +7,7 @@ This module implements the Search functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 
diff --git a/tmdbsimple/tv.py b/tmdbsimple/tv.py
index c4d6101..6e20c0d 100644
--- a/tmdbsimple/tv.py
+++ b/tmdbsimple/tv.py
@@ -8,7 +8,7 @@ functionality of tmdbsimple.
 
 Created by Celia Oakley on 2013-10-31.
 
-:copyright: (c) 2013-2017 by Celia Oakley
+:copyright: (c) 2013-2018 by Celia Oakley
 :license: GPLv3, see LICENSE for more details
 """
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-tmdbsimple.git



More information about the Python-modules-commits mailing list