diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2014-12-21 19:47:25 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2014-12-21 19:47:25 +0100 |
commit | 3008170f2bd120c43a876b1f1adba885db594618 (patch) | |
tree | 5f7c508e5181a1e28e33eae0fc771c25636cea73 /imdb-lookup | |
parent | 9089d2eb4bc34994abaf6ed173e95c97243789cd (diff) | |
download | scripts-3008170f2bd120c43a876b1f1adba885db594618.tar.gz scripts-3008170f2bd120c43a876b1f1adba885db594618.zip |
explicitly call close on requests response
Diffstat (limited to 'imdb-lookup')
-rwxr-xr-x | imdb-lookup/imdbinfo.py | 3 |
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) |