Update and improve documentation for API.followers
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 17:18:03 +0000 (12:18 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 17:18:03 +0000 (12:18 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add count, skip_status, and include_user_entities parameters to documentation
Remove id parameter from documentation
Improve parameter order in documentation

docs/api.rst
tweepy/api.py

index 1e9f5b7ec788a70da1fa2c29b117ee1fae6b9246..5197a1898aa2e146bf9caf3512d2303d7e6321de 100644 (file)
@@ -113,6 +113,8 @@ Follow, search, and get users
 
 .. automethod:: API.followers_ids
 
+.. automethod:: API.followers
+
 
 User methods
 ------------
@@ -150,21 +152,6 @@ User methods
    :rtype: list of :class:`User` objects
 
 
-.. method:: API.followers([id/screen_name/user_id], [cursor])
-
-   Returns a user's followers ordered in which they were added. If no user is
-   specified by id/screen name, it defaults to the authenticated user.
-
-   :param id: |uid|
-   :param user_id: |user_id|
-   :param screen_name: |screen_name|
-   :param cursor: |cursor|
-   :param count: |count|
-   :param skip_status: |skip_status|
-   :param include_user_entities: |include_user_entities|
-   :rtype: list of :class:`User` objects
-
-
 .. method:: API.lookup_users([user_ids], [screen_names], [include_entities], \
                              [tweet_mode])
 
index 85388bd24aa84631185bf06c78ef6d7bfbccd834..6b29132123f5c9620ab6fd5a0f24394d30d252b2 100644 (file)
@@ -1407,6 +1407,33 @@ class API:
             ), **kwargs
         )
 
+    @pagination(mode='cursor')
+    @payload('user', list=True)
+    def followers(self, **kwargs):
+        """followers(*, user_id, screen_name, cursor, count, skip_status, \
+                     include_user_entities)
+
+        Returns a user's followers ordered in which they were added. If no user
+        is specified by id/screen name, it defaults to the authenticated user.
+
+        :param user_id: |user_id|
+        :param screen_name: |screen_name|
+        :param cursor: |cursor|
+        :param count: |count|
+        :param skip_status: |skip_status|
+        :param include_user_entities: |include_user_entities|
+
+        :rtype: list of :class:`User` objects
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
+        """
+        return self.request(
+            'GET', 'followers/list', endpoint_parameters=(
+                'user_id', 'screen_name', 'cursor', 'count', 'skip_status',
+                'include_user_entities'
+            ), **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
@@ -1759,18 +1786,6 @@ class API:
             ), **kwargs
         )
 
-    @pagination(mode='cursor')
-    @payload('user', list=True)
-    def followers(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-list
-        """
-        return self.request(
-            'GET', 'followers/list', endpoint_parameters=(
-                'user_id', 'screen_name', 'cursor', 'count', 'skip_status',
-                'include_user_entities'
-            ), **kwargs
-        )
-
     @payload('json')
     def get_settings(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-settings