From 5745305efc680ce3efcadd8c03136f2421d4de7d Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:20:22 -0500 Subject: [PATCH] Update and improve documentation for API.list_timeline Automatically use docstring for documentation Improve method and documentation order Improve parameter order in documentation Improve capitalization --- docs/api.rst | 25 ++----------------------- tweepy/api.py | 47 +++++++++++++++++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 9cf91d9..b2b75ab 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -82,6 +82,8 @@ Create and manage lists .. automethod:: API.get_list +.. automethod:: API.list_timeline + User methods ------------ @@ -639,29 +641,6 @@ List Methods :rtype: list of :class:`List` objects -.. method:: API.list_timeline(list_id/slug, [owner_id/owner_screen_name], \ - [since_id], [max_id], [count], \ - [include_entities], [include_rts]) - - Returns a timeline of tweets authored by members of the specified list. - Retweets are included by default. Use the ``include_rts=false`` parameter to - omit retweets. - - :param list_id: |list_id| - :param slug: |slug| - :param owner_id: |owner_id| - :param owner_screen_name: |owner_screen_name| - :param since_id: |since_id| - :param max_id: |max_id| - :param count: |count| - :param include_entities: |include_entities| - :param include_rts: A boolean indicating whether the list timeline will - contain native retweets (if they exist) in addition to the standard - stream of tweets. The output format of retweeted tweets is identical to - the representation you see in home_timeline. - :rtype: list of :class:`Status` objects - - .. method:: API.add_list_member(list_id/slug, screen_name/user_id, \ [owner_id/owner_screen_name]) diff --git a/tweepy/api.py b/tweepy/api.py index 970bb95..0733ac9 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1036,6 +1036,41 @@ class API: ), **kwargs ) + @pagination(mode='id') + @payload('status', list=True) + def list_timeline(self, **kwargs): + """list_timeline(*, list_id, slug, owner_screen_name, owner_id, \ + since_id, max_id, count, include_entities, \ + include_rts) + + Returns a timeline of Tweets authored by members of the specified list. + Retweets are included by default. Use the ``include_rts=false`` + parameter to omit retweets. + + :param list_id: |list_id| + :param slug: |slug| + :param owner_screen_name: |owner_screen_name| + :param owner_id: |owner_id| + :param since_id: |since_id| + :param max_id: |max_id| + :param count: |count| + :param include_entities: |include_entities| + :param include_rts: A boolean indicating whether the list timeline will + contain native retweets (if they exist) in addition to the standard + stream of Tweets. The output format of retweeted Tweets is + identical to the representation you see in home_timeline. + + :rtype: list of :class:`Status` objects + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses + """ + return self.request( + 'GET', 'lists/statuses', endpoint_parameters=( + 'list_id', 'slug', 'owner_screen_name', 'owner_id', 'since_id', + 'max_id', 'count', 'include_entities', 'include_rts' + ), **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 @@ -1654,18 +1689,6 @@ class API: ), **kwargs ) - @pagination(mode='id') - @payload('status', list=True) - def list_timeline(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-statuses - """ - return self.request( - 'GET', 'lists/statuses', endpoint_parameters=( - 'list_id', 'slug', 'owner_screen_name', 'owner_id', 'since_id', - 'max_id', 'count', 'include_entities', 'include_rts' - ), **kwargs - ) - @payload('list') def add_list_member(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-create -- 2.25.1