diff options
author | mathieui <mathieui@mathieui.net> | 2017-10-14 16:30:54 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2017-10-14 16:30:54 +0200 |
commit | 9d261c902f075b7a8bdab26f8384942ff7f949be (patch) | |
tree | 86ef7a24cf4191666a1ba9d61a9961f3d67e370e | |
parent | e7d8d2aaf50ab9cea23732129adf2c3ed1f40f70 (diff) | |
download | poezio-9d261c902f075b7a8bdab26f8384942ff7f949be.tar.gz poezio-9d261c902f075b7a8bdab26f8384942ff7f949be.tar.bz2 poezio-9d261c902f075b7a8bdab26f8384942ff7f949be.tar.xz poezio-9d261c902f075b7a8bdab26f8384942ff7f949be.zip |
Remove use of deprecated base64.encodestring method
-rw-r--r-- | poezio/common.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/poezio/common.py b/poezio/common.py index c078b36c..7168fe18 100644 --- a/poezio/common.py +++ b/poezio/common.py @@ -38,9 +38,9 @@ def get_base64_from_file(path): size = os.path.getsize(path) if size > 16384: return (None, None, "File is too big") - fdes = open(path, 'rb') - data = fdes.read() - encoded = base64.encodestring(data) + with open(path, 'rb') as fdes: + data = fdes.read() + encoded = base64.encodebytes(data) sha1 = hashlib.sha1(data).hexdigest() mime_type = mimetypes.guess_type(path)[0] return (encoded, mime_type, sha1) |