increase max image size for gif
authorYechiel K <contact@yechiel.me>
Sun, 1 Mar 2020 20:27:47 +0000 (15:27 -0500)
committerYechiel K <contact@yechiel.me>
Sun, 1 Mar 2020 20:38:05 +0000 (15:38 -0500)
tweepy/api.py

index 0ceedcae086d1e84cda72ab068787a4922d6d6e1..aa6872f472ca2c2c288dc43f12ce0acbbb3b0f79 100644 (file)
@@ -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})