From 400d40944f423bd6ba52750d2b94e87202db6b23 Mon Sep 17 00:00:00 2001 From: keatonconrad Date: Tue, 15 Dec 2020 22:15:59 -0600 Subject: [PATCH] Added getting file_type by filestream --- tweepy/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 4a2599c..1bb16e0 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1418,7 +1418,7 @@ class API(object): # image must be gif, jpeg, png, webp if not file_type: - file_type = imghdr.what(filename) or mimetypes.guess_type(filename)[0] + file_type = imghdr.what(filename, h=f) or mimetypes.guess_type(filename)[0] if file_type is None: raise TweepError('Could not determine file type') if file_type in ['gif', 'jpeg', 'png', 'webp']: -- 2.25.1