Update and improve documentation for API.lists_ownerships
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:10:22 +0000 (10:10 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:11:00 +0000 (10:11 -0500)
Automatically use docstring for documentation
Improve method and documentation order

docs/api.rst
tweepy/api.py

index 1f85bb5e0e41a2a04fbaf19164ff89b689ea2acc..01e218195f16ac2c4ac41e31d66acce248f03bce 100644 (file)
@@ -78,6 +78,8 @@ Create and manage lists
 
 .. automethod:: API.lists_memberships
 
+.. automethod:: API.lists_ownerships
+
 
 User methods
 ------------
@@ -622,20 +624,6 @@ List Methods
    :rtype: :class:`List` object
 
 
-.. method:: API.lists_ownerships([user_id], [screen_name], [count], [cursor])
-
-   Returns the lists owned by the specified user. Private lists will only be
-   shown if the authenticated user is also the owner of the lists. If
-   ``user_id`` and ``screen_name`` are not provided, the ownerships for the
-   authenticating user are returned.
-
-   :param user_id: |user_id|
-   :param screen_name: |screen_name|
-   :param count: |count|
-   :param cursor: |cursor|
-   :rtype: list of :class:`List` objects
-
-
 .. method:: API.lists_subscriptions([screen_name], [user_id], [cursor], \
                                     [count])
 
index 9dd4790a65d1945252ef74e6680ce4d5c60d9d3b..bd38aa6fcd5ba3f5b94e8ae4b1f091da246179d2 100644 (file)
@@ -989,6 +989,31 @@ class API:
             ), **kwargs
         )
 
+    @pagination(mode='cursor')
+    @payload('list', list=True)
+    def lists_ownerships(self, **kwargs):
+        """lists_ownerships(*, user_id, screen_name, count, cursor)
+
+        Returns the lists owned by the specified user. Private lists will only
+        be shown if the authenticated user is also the owner of the lists. If
+        ``user_id`` and ``screen_name`` are not provided, the ownerships for
+        the authenticating user are returned.
+
+        :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-ownerships
+        """
+        return self.request(
+            'GET', 'lists/ownerships', 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
@@ -1596,17 +1621,6 @@ class API:
             ), **kwargs
         )
 
-    @pagination(mode='cursor')
-    @payload('list', list=True)
-    def lists_ownerships(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/get-lists-ownerships
-        """
-        return self.request(
-            'GET', 'lists/ownerships', endpoint_parameters=(
-                'user_id', 'screen_name', 'count', 'cursor'
-            ), **kwargs
-        )
-
     @pagination(mode='cursor')
     @payload('list', list=True)
     def lists_subscriptions(self, **kwargs):