add upload_media_with_file function.

This commit is contained in:
Himanoa 2015-10-08 17:34:29 +09:00
parent c59de5c1df
commit 123cfe0917

View file

@ -144,6 +144,10 @@ class EndpointsMixin(object):
""" """
return self.post('https://upload.twitter.com/1.1/media/upload.json', params=params) 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): 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 """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 to a status for 60 minutes. To attach to a update, pass a list of returned media ids