From 73a97cfe0cb277d23fe8558f01de40b1fd92b63b Mon Sep 17 00:00:00 2001 From: fkropfhamer Date: Mon, 10 Aug 2020 12:40:29 +0200 Subject: [PATCH] added transformation to bytes --- tweepy/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 38b7a2e..a424a39 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -220,8 +220,9 @@ class API(object): :allowed_param: """ f = kwargs.pop('file', None) + h = f.read(32) - file_type = imghdr.what(filename, f) or mimetypes.guess_type(filename)[0] + file_type = imghdr.what(filename, h=h) or mimetypes.guess_type(filename)[0] if file_type == 'gif': max_size = 14649 else: -- 2.25.1