.. automethod:: API.get_media_upload_status
+.. automethod:: API.create_media_metadata
+
Account Methods
---------------
:rtype: :class:`Media` object
-.. method:: API.create_media_metadata(media_id, alt_text)
-
- This endpoint can be used to provide additional information about the
- uploaded media_id. This feature is currently only supported for images and
- GIFs. Call this endpoint to attach additional metadata such as image alt
- text.
-
- :param media_id: The ID of the media to add alt text to.
- :param alt_text: The alt text to add to the image.
-
-
:mod:`tweepy.error` --- Exceptions
==================================
), command='STATUS', media_id=media_id, upload_api=True, **kwargs
)
+ def create_media_metadata(self, media_id, alt_text, **kwargs):
+ """create_media_metadata(media_id, alt_text)
+
+ This endpoint can be used to provide additional information about the
+ uploaded ``media_id``. This feature is currently only supported for
+ images and GIFs. Call this endpoint to attach additional metadata such
+ as image alt text.
+
+ :param media_id: The ID of the media to add alt text to.
+ :param alt_text: The alt text to add to the image.
+
+ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-metadata-create
+ """
+ json_payload = {
+ 'media_id': media_id,
+ 'alt_text': {'text': alt_text}
+ }
+
+ return self.request(
+ 'POST', 'media/metadata/create', json_payload=json_payload,
+ upload_api=True, **kwargs
+ )
+
def media_upload(self, filename, *, file=None, chunked=False,
media_category=None, additional_owners=None, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview
upload_api=True, **kwargs
)
- def create_media_metadata(self, media_id, alt_text, **kwargs):
- """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-metadata-create
- """
- json_payload = {
- 'media_id': media_id,
- 'alt_text': {'text': alt_text}
- }
-
- return self.request(
- 'POST', 'media/metadata/create', json_payload=json_payload,
- upload_api=True, **kwargs
- )
-
@payload('json')
def rate_limit_status(self, **kwargs):
""" :reference: https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status