From 455bb76d4e14d079f64bcc2b0eab51820cda1fe7 Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 11 Apr 2021 13:26:57 -0500 Subject: [PATCH] Update and improve documentation for API.media_upload Automatically use docstring for documentation Improve documentation order Improve formatting --- docs/api.rst | 23 ++--------------------- tweepy/api.py | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 22 deletions(-) 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: -- 2.25.1