From 33776a80930fe7b6a199b1b86fd8a78786e176e2 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Sun, 27 Dec 2015 05:28:48 -0500 Subject: [PATCH] closed file in upload_from_path The file no longer remains open after calling upload_from_path(). This would previously throw warnings. --- imgurpython/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgurpython/client.py b/imgurpython/client.py index 544330b..b860a1a 100644 --- a/imgurpython/client.py +++ b/imgurpython/client.py @@ -586,13 +586,13 @@ def upload_from_path(self, path, config=None, anon=True): fd = open(path, 'rb') contents = fd.read() b64 = base64.b64encode(contents) - data = { 'image': b64, 'type': 'base64', } - data.update({meta: config[meta] for meta in set(self.allowed_image_fields).intersection(config.keys())}) + fd.close() + return self.make_request('POST', 'upload', data, anon) def upload_from_url(self, url, config=None, anon=True):