summaryrefslogtreecommitdiff
path: root/imdb-lookup
diff options
context:
space:
mode:
Diffstat (limited to 'imdb-lookup')
-rwxr-xr-ximdb-lookup/imdbinfo.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/imdb-lookup/imdbinfo.py b/imdb-lookup/imdbinfo.py
index 3c48826..e1fe5be 100755
--- a/imdb-lookup/imdbinfo.py
+++ b/imdb-lookup/imdbinfo.py
@@ -117,6 +117,7 @@ class TMDBCache(object):
r = requests.get(url)
self.db_images[key] = r.content
self.db_images[keyContentType] = r.headers['content-type']
+ r.close()
return (self.db_images[keyContentType], self.db_images[key])
def poster_low(self, poster_path, format="w154"):
@@ -159,6 +160,7 @@ class TMDBCache(object):
r = self._imdb_request("/title/maindetails", {'tconst': movie_id})
assert r.status_code == 200, "Request must return status-code 200"
data = json.loads(r.text)
+ r.close()
assert data is not None and data['data'], "Data must not be empty"
return data
key = "imdb_maindetails_{}".format(movie_id)
@@ -171,6 +173,7 @@ class TMDBCache(object):
r = requests.get(BASE_URI, params=params)
assert r.status_code == 200, "Request must return status-code 200"
data = json.loads(r.text)
+ r.close()
assert data is not None and data['Response'] == 'True', "Data must not be empty"
return data
key = "omdb_{}".format(movie_id)