From 8522e4f50f7c3e659200ea9093c88b25198fbd70 Mon Sep 17 00:00:00 2001 From: Yechiel K Date: Sun, 1 Mar 2020 15:27:47 -0500 Subject: [PATCH] increase max image size for gif --- tweepy/api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tweepy/api.py b/tweepy/api.py index 0ceedca..aa6872f 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -219,7 +219,14 @@ class API(object): :allowed_param: """ f = kwargs.pop('file', None) - headers, post_data = API._pack_image(filename, 4883, + + file_type = imghdr.what(filename) + if file_type == 'gif': + max_size = 15360 + else: + max_size = 4883 + + headers, post_data = API._pack_image(filename, max_size, form_field='media', f=f) kwargs.update({'headers': headers, 'post_data': post_data}) -- 2.25.1