From 76b46a4f3e956f6dd46413228894155f657ce9f1 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 13 Jan 2021 11:45:59 -0600 Subject: [PATCH] Use initial file pointer location in API.chunked_upload Rather than resetting to the beginning of the passed file --- tweepy/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 69b8bde..bf5e0c6 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -259,10 +259,10 @@ class API: fp = file or open(filename, 'rb') + start = fp.tell() fp.seek(0, 2) # Seek to end of file - file_size = fp.tell() - - fp.seek(0) # Reset to beginning of file + file_size = fp.tell() - start + fp.seek(start) media_id = self.chunked_upload_init( file_size, file_type, -- 2.25.1