Skip to content

Commit 7dd2ff5

Browse files
author
Garland Trice
authored
media category fix 2
doing this from github ui. bad thing to do, don't do this.
1 parent eb789cd commit 7dd2ff5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

twitter/twitter_utils.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def http_to_file(http):
216216
return data_file
217217

218218

219-
def parse_media_file(passed_media):
219+
def parse_media_file(passed_media, media_category=None):
220220
""" Parses a media file and attempts to return a file-like object and
221221
information about the media file.
222222
@@ -265,7 +265,8 @@ def parse_media_file(passed_media):
265265
media_type = mimetypes.guess_type(os.path.basename(filename))[0]
266266
if media_type is not None:
267267
if media_type in img_formats and file_size > 5 * 1048576:
268-
raise TwitterError({'message': 'Images must be less than 5MB.'})
268+
if media_category is not 'tweet_gif':
269+
raise TwitterError({'message': 'Images must be less than 5MB.'})
269270
elif media_type in video_formats and file_size > 15 * 1048576:
270271
raise TwitterError({'message': 'Videos must be less than 15MB.'})
271272
elif media_type not in img_formats and media_type not in video_formats:

0 commit comments

Comments
 (0)