From 1caef2556977987649a94cc4693695ff735ff49b Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 10:31:21 -0500 Subject: [PATCH] Update and improve documentation for API.lists_subscriptions Automatically use docstring for documentation Improve method and documentation order Improve parameter order in documentation --- docs/api.rst | 15 ++------------- tweepy/api.py | 34 +++++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index 4609131..014841b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -88,6 +88,8 @@ Create and manage lists .. automethod:: API.show_list_subscriber +.. automethod:: API.lists_subscriptions + User methods ------------ @@ -632,19 +634,6 @@ List Methods :rtype: :class:`List` object -.. method:: API.lists_subscriptions([screen_name], [user_id], [cursor], \ - [count]) - - Obtain a collection of the lists the specified user is subscribed to, 20 - lists per page by default. Does not include the user's own lists. - - :param screen_name: |screen_name| - :param user_id: |user_id| - :param cursor: |cursor| - :param count: |count| - :rtype: list of :class:`List` 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 8eb04db..96462e6 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1128,6 +1128,29 @@ class API: ), **kwargs ) + @pagination(mode='cursor') + @payload('list', list=True) + def lists_subscriptions(self, **kwargs): + """lists_subscriptions(*, user_id, screen_name, count, cursor) + + Obtain a collection of the lists the specified user is subscribed to, + 20 lists per page by default. Does not include the user's own lists. + + :param user_id: |user_id| + :param screen_name: |screen_name| + :param count: |count| + :param cursor: |cursor| + + :rtype: list of :class:`List` objects + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions + """ + return self.request( + 'GET', 'lists/subscriptions', endpoint_parameters=( + 'user_id', 'screen_name', 'count', 'cursor' + ), **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 @@ -1735,17 +1758,6 @@ class API: ), **kwargs ) - @pagination(mode='cursor') - @payload('list', list=True) - def lists_subscriptions(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-subscriptions - """ - return self.request( - 'GET', 'lists/subscriptions', endpoint_parameters=( - 'user_id', 'screen_name', 'count', 'cursor' - ), **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