From 123cfe0917bc3b100e7af2c77adec08fdb1c1d81 Mon Sep 17 00:00:00 2001 From: Himanoa Date: Thu, 8 Oct 2015 17:34:29 +0900 Subject: [PATCH] add upload_media_with_file function. --- twython/endpoints.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/twython/endpoints.py b/twython/endpoints.py index 561ec45..328f26f 100644 --- a/twython/endpoints.py +++ b/twython/endpoints.py @@ -144,6 +144,10 @@ class EndpointsMixin(object): """ return self.post('https://upload.twitter.com/1.1/media/upload.json', params=params) + def upload_media_with_file(self, filename): + with open(filename, 'rb') as f: + return self.upload_media(media=f) + def upload_video(self, media, media_type, size=None): """Uploads video file to Twitter servers in chunks. The file will be available to be attached to a status for 60 minutes. To attach to a update, pass a list of returned media ids -- 2.39.5