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

docs/api.rst
tweepy/api.py

index 3366fdbe89251dd5f7a9c26080fdc1c3779703bb..c9c4002429c4e4a9311edbab1bba7941ba5b7c84 100644 (file)
@@ -106,6 +106,8 @@ Create and manage lists
 
 .. automethod:: API.unsubscribe_list
 
+.. automethod:: API.update_list
+
 
 User methods
 ------------
@@ -608,25 +610,6 @@ Search Methods
       provided by the API, and should not be modified.
 
 
-List Methods
-------------
-
-.. method:: API.update_list(list_id/slug, [name], [mode], [description], \
-                            [owner_screen_name/owner_id])
-
-   Updates the specified list.
-   The authenticated user must own the list to be able to update it.
-
-   :param list_id: |list_id|
-   :param slug: |slug|
-   :param name: The name for the list.
-   :param mode: |list_mode|
-   :param description: The description to give the list.
-   :param owner_screen_name: |owner_screen_name|
-   :param owner_id: |owner_id|
-   :rtype: :class:`List` object
-
-
 Trends Methods
 --------------
 
index 19919f07197e4119c857ae3fe2cf529d867c2fae..8582333759442403d03f88360e2f5b4feb4a4f64 100644 (file)
@@ -1354,6 +1354,33 @@ class API:
             ), **kwargs
         )
 
+    @payload('list')
+    def update_list(self, **kwargs):
+        """update_list(*, list_id, slug, name, mode, description, \
+                       owner_screen_name, owner_id)
+
+        Updates the specified list.
+        The authenticated user must own the list to be able to update it.
+
+        :param list_id: |list_id|
+        :param slug: |slug|
+        :param name: The name for the list.
+        :param mode: |list_mode|
+        :param description: The description to give the list.
+        :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-update
+        """
+        return self.request(
+            'POST', 'lists/update', endpoint_parameters=(
+                'list_id', 'slug', 'name', 'mode', 'description',
+                '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
@@ -1930,17 +1957,6 @@ class API:
         """
         return self.request('POST', f'saved_searches/destroy/{id}', **kwargs)
 
-    @payload('list')
-    def update_list(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-update
-        """
-        return self.request(
-            'POST', 'lists/update', endpoint_parameters=(
-                'list_id', 'slug', 'name', 'mode', 'description',
-                'owner_screen_name', 'owner_id'
-            ), **kwargs
-        )
-
     @payload('json')
     def trends_available(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-available