From 3008170f2bd120c43a876b1f1adba885db594618 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sun, 21 Dec 2014 19:47:25 +0100 Subject: explicitly call close on requests response --- imdb-lookup/imdbinfo.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'imdb-lookup/imdbinfo.py') 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) -- cgit v1.2.1