From: keatonconrad Date: Wed, 16 Dec 2020 04:15:59 +0000 (-0600) Subject: Added getting file_type by filestream X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=400d40944f423bd6ba52750d2b94e87202db6b23;p=tweepy.git Added getting file_type by filestream --- 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']: