# See LICENSE for details.
import imghdr
+import mimetypes
import os
import six
"""
f = kwargs.pop('file', None)
- file_type = imghdr.what(filename)
+ file_type = imghdr.what(filename) or mimetypes.guess_type(filename)[0]
if file_type == 'gif':
max_size = 14649
else:
# image must be gif, jpeg, png, webp
if not file_type:
- file_type = imghdr.what(filename)
+ file_type = imghdr.what(filename) or mimetypes.guess_type(filename)[0]
if file_type is None:
raise TweepError('Could not determine file type')
- if file_type not in ['gif', 'jpeg', 'png', 'webp']:
+ if file_type not in ['gif', 'jpeg', 'png', 'webp', 'image/gif', 'image/jpeg', 'image/png']:
raise TweepError('Invalid file type for image: %s' % file_type)
if isinstance(filename, six.text_type):