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

docs/api.rst
tweepy/api.py

index 19649c0683b41ee3795bdeaab0ef1debd0b4899c..7e2d843c3aa93845f0bf71b8350bfc78476bf034 100644 (file)
@@ -102,6 +102,8 @@ Create and manage lists
 
 .. automethod:: API.remove_list_members
 
+.. automethod:: API.subscribe_list
+
 
 User methods
 ------------
@@ -623,17 +625,6 @@ List Methods
    :rtype: :class:`List` object
 
 
-.. method:: API.subscribe_list(list_id/slug, [owner_id/owner_screen_name])
-
-   Subscribes the authenticated user to the specified list.
-
-   :param list_id: |list_id|
-   :param slug: |slug|
-   :param owner_id: |owner_id|
-   :param owner_screen_name: |owner_screen_name|
-   :rtype: :class:`List` object
-
-
 .. method:: API.unsubscribe_list(list_id/slug, [owner_id/owner_screen_name])
 
    Unsubscribes the authenticated user from the specified list.
index acb9661970451a1f2d0d699b851be5b6e5334890..5de57662246b476c8ceb38c33f3dfeb8770304e7 100644 (file)
@@ -1312,6 +1312,27 @@ class API:
             ), **kwargs
         )
 
+    @payload('list')
+    def subscribe_list(self, **kwargs):
+        """subscribe_list(*, owner_screen_name, owner_id, list_id, slug)
+
+        Subscribes the authenticated user to the specified list.
+
+        :param owner_screen_name: |owner_screen_name|
+        :param owner_id: |owner_id|
+        :param list_id: |list_id|
+        :param slug: |slug|
+
+        :rtype: :class:`List` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-create
+        """
+        return self.request(
+            'POST', 'lists/subscribers/create', endpoint_parameters=(
+                'owner_screen_name', 'owner_id', 'list_id', 'slug'
+            ), **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
@@ -1899,16 +1920,6 @@ class API:
             ), **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
-        """
-        return self.request(
-            'POST', 'lists/subscribers/create', endpoint_parameters=(
-                'owner_screen_name', 'owner_id', 'list_id', 'slug'
-            ), **kwargs
-        )
-
     @payload('list')
     def unsubscribe_list(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/create-manage-lists/api-reference/post-lists-subscribers-destroy