Update and improve documentation for API.remove_list_members
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:51:30 +0000 (10:51 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 15:51:40 +0000 (10:51 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Improve parameter order in documentation

docs/api.rst
tweepy/api.py

index e8f3aa6f9539db3c6a3929d2af26a2fb678dad14..19649c0683b41ee3795bdeaab0ef1debd0b4899c 100644 (file)
@@ -100,6 +100,8 @@ Create and manage lists
 
 .. automethod:: API.remove_list_member
 
+.. automethod:: API.remove_list_members
+
 
 User methods
 ------------
@@ -621,24 +623,6 @@ List Methods
    :rtype: :class:`List` object
 
 
-.. method:: API.remove_list_members(list_id/slug, screen_name/user_id, \
-                                    [owner_id/owner_screen_name])
-
-   Remove up to 100 members from a list. The authenticated user must own the
-   list to be able to remove members from it. Lists are limited to 5,000
-   members.
-
-   :param list_id: |list_id|
-   :param slug: |slug|
-   :param screen_name: A comma separated list of screen names, up to 100 are
-                       allowed in a single request
-   :param user_id: A comma separated list of user IDs, up to 100 are allowed in
-                   a single request
-   :param owner_id: |owner_id|
-   :param owner_screen_name: |owner_screen_name|
-   :rtype: :class:`List` object
-
-
 .. method:: API.subscribe_list(list_id/slug, [owner_id/owner_screen_name])
 
    Subscribes the authenticated user to the specified list.
index 18d6aab2d7c737f0b7e0b0e93950fee803aee88e..acb9661970451a1f2d0d699b851be5b6e5334890 100644 (file)
@@ -1279,6 +1279,39 @@ class API:
             ), **kwargs
         )
 
+    @payload('list')
+    def remove_list_members(self, **kwargs):
+        """remove_list_members(*, list_id, slug, user_id, screen_name, \
+                               owner_screen_name, owner_id)
+
+        Remove up to 100 members from a list. The authenticated user must own
+        the list to be able to remove members from it. Lists are limited to
+        5,000 members.
+
+        :param list_id: |list_id|
+        :param slug: |slug|
+        :param user_id: A comma separated list of user IDs, up to 100 are
+                        allowed in a single request
+        :param screen_name: A comma separated list of screen names, up to 100
+                            are allowed in a single request
+        :param owner_screen_name: |owner_screen_name|
+        :param owner_id: |owner_id|
+
+        :rtype: :class:`List` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all
+        """
+        if 'user_id' in kwargs:
+            kwargs['user_id'] = list_to_csv(kwargs['user_id'])
+        if 'screen_name' in kwargs:
+            kwargs['screen_name'] = list_to_csv(kwargs['screen_name'])
+        return self.request(
+            'POST', 'lists/members/destroy_all', endpoint_parameters=(
+                'list_id', 'slug', 'user_id', 'screen_name',
+                'owner_screen_name', 'owner_id'
+            ), **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
@@ -1866,21 +1899,6 @@ class API:
             ), **kwargs
         )
 
-    @payload('list')
-    def remove_list_members(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-members-destroy_all
-        """
-        if 'user_id' in kwargs:
-            kwargs['user_id'] = list_to_csv(kwargs['user_id'])
-        if 'screen_name' in kwargs:
-            kwargs['screen_name'] = list_to_csv(kwargs['screen_name'])
-        return self.request(
-            'POST', 'lists/members/destroy_all', endpoint_parameters=(
-                'list_id', 'slug', 'user_id', 'screen_name',
-                'owner_screen_name', 'owner_id'
-            ), **kwargs
-        )
-
     @payload('list')
     def subscribe_list(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create