From: Harmon Date: Wed, 7 Apr 2021 14:50:09 +0000 (-0500) Subject: Update and improve documentation for API.lists_all X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c7c65fa0b8793711cc023b0a85f7efa84498144f;p=tweepy.git Update and improve documentation for API.lists_all Automatically use docstring for documentation Improve method and documentation order Add API documentation headers to match API reference index Improve parameter order in documentation --- diff --git a/docs/api.rst b/docs/api.rst index 6850620..46d73dc 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -64,6 +64,14 @@ Search Tweets .. automethod:: API.search +Accounts and users +------------------ + +Create and manage lists +^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.lists_all + User methods ------------ @@ -608,28 +616,6 @@ List Methods :rtype: :class:`List` object -.. method:: API.lists_all([screen_name], [user_id], [reverse]) - - Returns all lists the authenticating or specified user subscribes to, - including their own. The user is specified using the ``user_id`` or - ``screen_name`` parameters. If no user is given, the authenticating user is - used. - - A maximum of 100 results will be returned by this call. Subscribed lists are - returned first, followed by owned lists. This means that if a user - subscribes to 90 lists and owns 20 lists, this method returns 90 - subscriptions and 10 owned lists. The ``reverse`` method returns owned lists - first, so with ``reverse=true``, 20 owned lists and 80 subscriptions would - be returned. - - :param screen_name: |screen_name| - :param user_id: |user_id| - :param reverse: A boolean indicating if you would like owned lists to be - returned first. See description above for information on how - this parameter works. - :rtype: list of :class:`List` objects - - .. method:: API.lists_memberships([screen_name], [user_id], \ [filter_to_owned_lists], [cursor], [count]) diff --git a/tweepy/api.py b/tweepy/api.py index b563d0d..4496ed9 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -869,6 +869,40 @@ class API: ), q=q, **kwargs ) + # Create and manage lists + + @payload('list', list=True) + def lists_all(self, **kwargs): + """lists_all(*, user_id, screen_name, reverse) + + Returns all lists the authenticating or specified user subscribes to, + including their own. The user is specified using the ``user_id`` or + ``screen_name`` parameters. If no user is given, the authenticating + user is used. + + A maximum of 100 results will be returned by this call. Subscribed + lists are returned first, followed by owned lists. This means that if a + user subscribes to 90 lists and owns 20 lists, this method returns 90 + subscriptions and 10 owned lists. The ``reverse`` method returns owned + lists first, so with ``reverse=true``, 20 owned lists and 80 + subscriptions would be returned. + + :param user_id: |user_id| + :param screen_name: |screen_name| + :param reverse: A boolean indicating if you would like owned lists to + be returned first. See description above for + information on how this parameter works. + + :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-list + """ + return self.request( + 'GET', 'lists/list', endpoint_parameters=( + 'user_id', 'screen_name', 'reverse' + ), **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 @@ -1476,16 +1510,6 @@ class API: ), **kwargs ) - @payload('list', list=True) - def lists_all(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-list - """ - return self.request( - 'GET', 'lists/list', endpoint_parameters=( - 'user_id', 'screen_name', 'reverse' - ), **kwargs - ) - @pagination(mode='cursor') @payload('list', list=True) def lists_memberships(self, **kwargs):