From 5dfe5ca48c2183b7393803cc2a0ff0d03b8d41fb Mon Sep 17 00:00:00 2001 From: fitnr Date: Wed, 9 Sep 2020 19:45:42 -0400 Subject: [PATCH] Add media_upload_status method --- docs/api.rst | 9 +++++++++ tweepy/api.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 8aa4a03..f525127 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1277,6 +1277,15 @@ Media methods :param alt_text: The alt text to add to the image. +.. method:: API.get_media_upload_status(media_id) + + This endpoints sends a STATUS command that will check on the progress of + a chunked media upload. If the upload has succeeded, it's safe to create + a tweet with this ``media_id``\ . + + :param media_id: The ID of the media to check. + + :mod:`tweepy.error` --- Exceptions ================================== diff --git a/tweepy/api.py b/tweepy/api.py index 9614890..f0e44be 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -400,6 +400,20 @@ class API(object): require_auth=True )(*args, **kwargs) + def get_media_upload_status(self, *args, **kwargs): + """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/get-media-upload-status + :allowed_param: 'media_ids' + """ + kwargs['command'] = 'STATUS' + return bind_api( + api=self, + path='/media/upload.json', + payload_type='media', + allowed_param=['media_id'], + upload_api=True, + require_auth=True + )(*args, **kwargs) + @property def destroy_status(self): """ :reference: https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/post-statuses-destroy-id -- 2.25.1