From 3733fd673b04b9aa193886d6b8eb9fdaf1718341 Mon Sep 17 00:00:00 2001 From: Harmon Date: Thu, 13 Feb 2020 15:35:36 -0600 Subject: [PATCH] Support WebP images Resolves #1298 --- tweepy/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index a51d32d..0ceedca 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1377,11 +1377,11 @@ class API(object): f.seek(0) # Reset to beginning of file fp = f - # image must be gif, jpeg, or png + # image must be gif, jpeg, png, webp file_type = imghdr.what(filename) if file_type is None: raise TweepError('Could not determine file type') - if file_type not in ['gif', 'jpeg', 'png']: + if file_type not in ['gif', 'jpeg', 'png', 'webp']: raise TweepError('Invalid file type for image: %s' % file_type) if isinstance(filename, six.text_type): -- 2.25.1