From: Harmon Date: Sun, 11 Apr 2021 18:26:57 +0000 (-0500) Subject: Update and improve documentation for API.media_upload X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=455bb76d4e14d079f64bcc2b0eab51820cda1fe7;p=tweepy.git Update and improve documentation for API.media_upload Automatically use docstring for documentation Improve documentation order Improve formatting --- diff --git a/docs/api.rst b/docs/api.rst index 8d79727..2423e17 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -213,6 +213,8 @@ Upload media .. automethod:: API.create_media_metadata +.. automethod:: API.media_upload + Account Methods --------------- @@ -430,27 +432,6 @@ Utility methods Media methods ------------- -.. method:: API.media_upload(filename, [file], [chunked], [media_category], \ - [additional_owners]) - - Use this to upload media to Twitter. - This calls either :func:`API.simple_upload` or :func:`API.chunked_upload`. - Chunked media upload is automatically used for videos. - If ``chunked`` is set or the media is a video, ``wait_for_async_finalize`` - can be specified as a keyword argument to be passed to - :func:`API.chunked_upload`. - - :param filename: |filename| - :param file: |file| - :param chunked: Whether or not to use chunked media upload. Videos use - chunked upload regardless of this parameter. Defaults to - False. - :param media_category: |media_category| - :param additional_owners: |additional_owners| - - :rtype: :class:`Media` object - - .. method:: API.simple_upload(filename, [file], [media_category], \ [additional_owners]) diff --git a/tweepy/api.py b/tweepy/api.py index 1dd0ce9..252e1fb 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2346,7 +2346,26 @@ class API: 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 + """media_upload(filename, *, file, chunked, media_category, \ + additional_owners) + + Use this to upload media to Twitter. This calls either + :func:`API.simple_upload` or :func:`API.chunked_upload`. Chunked media + upload is automatically used for videos. If ``chunked`` is set or the + media is a video, ``wait_for_async_finalize`` can be specified as a + keyword argument to be passed to :func:`API.chunked_upload`. + + :param filename: |filename| + :param file: |file| + :param chunked: Whether or not to use chunked media upload. Videos use + chunked upload regardless of this parameter. Defaults + to ``False``. + :param media_category: |media_category| + :param additional_owners: |additional_owners| + + :rtype: :class:`Media` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview """ h = None if file is not None: