Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit 56ce285

Browse files
committed
Added code to check if it is a gif and over 5MB
and if so notify twitter that it is a gif so that it will be uploaded.
1 parent a1fe9c8 commit 56ce285

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

twitter/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,10 @@ def _UploadMediaChunkedInit(self,
12771277
parameters['media_type'] = media_type
12781278
parameters['total_bytes'] = file_size
12791279

1280+
# Without this GIF files over 5MB but less than 15MB will fail uploading.
1281+
if media_type == 'image/gif' and file_size > 5242880:
1282+
parameters['media_category'] = 'tweet_gif'
1283+
12801284
resp = self._RequestUrl(url, 'POST', data=parameters)
12811285
data = self._ParseAndCheckTwitter(resp.content.decode('utf-8'))
12821286

0 commit comments

Comments
 (0)