Update tweepy/api.py
authorFabian Kropfhamer <54098356+fkropfhamer@users.noreply.github.com>
Tue, 22 Dec 2020 17:17:55 +0000 (18:17 +0100)
committerGitHub <noreply@github.com>
Tue, 22 Dec 2020 17:17:55 +0000 (18:17 +0100)
Co-authored-by: Harmon <Harmon758@gmail.com>
tweepy/api.py

index 0df8da3b2ec5e0eb9d57e1792f50a0cb29075ddf..66e95d262b8e00cb2546b4d3091363a445b8be63 100644 (file)
@@ -220,10 +220,12 @@ class API(object):
             :allowed_param:
         """
         f = kwargs.pop('file', None)
+
         h = None
-        if f:
+        if f is not None:
+            location = f.tell()
             h = f.read(32)
-
+            f.seek(location)
         file_type = imghdr.what(filename, h=h) or mimetypes.guess_type(filename)[0]
         if file_type == 'gif':
             max_size = 14649