From a6ff2d8166723026b3db0092399fe6f694fa0750 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Mon, 8 Dec 2014 23:49:07 +0100 Subject: more data! --- imdb-lookup/imdbinfo.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'imdb-lookup/imdbinfo.py') diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py index 5c88fc1..eeea947 100755 --- a/imdb-lookup/imdbinfo.py +++ b/imdb-lookup/imdbinfo.py @@ -167,6 +167,18 @@ class TMDBCache(object): key = "imdb_maindetails_{}".format(movie_id) return self._cache(key, do_request) + def omdb_movie(self, movie_id): + def do_request(): + BASE_URI="http://www.omdbapi.com/" + params={'i':movie_id, 'plot':'short', 'r':'json', 'tomatoes':'true'} + r = requests.get(BASE_URI, params=params) + assert r.status_code == 200, "Request must return status-code 200" + data = json.loads(r.text) + assert data is not None and data['Response'] == 'True', "Data must not be empty" + return data + key = "omdb_{}".format(movie_id) + return self._cache(key, do_request) + def weight_rating(infos): """ add 'rating' to all infos""" -- cgit v1.2.1