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

docs/api.rst
tweepy/api.py

index 9ff1448a5dab3439c02e393d68b208d7e8f04f7b..ca8870ef27f9db7403bd1e772dc9dc936b2be9ba 100644 (file)
@@ -117,6 +117,8 @@ Follow, search, and get users
 
 .. automethod:: API.friends_ids
 
+.. automethod:: API.friends
+
 
 User methods
 ------------
@@ -138,22 +140,6 @@ User methods
    :rtype: :class:`User` object
 
 
-.. method:: API.friends([id/user_id/screen_name], [cursor], [skip_status], \
-                        [include_user_entities])
-
-   Returns a user's friends ordered in which they were added 100 at a time.
-   If no user is specified 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 48e74b3c3e5be60583c20227450bd456379c256e..31920341402556e91cdd0df4cd411d985fe88498 100644 (file)
@@ -1458,6 +1458,33 @@ class API:
             ), **kwargs
         )
 
+    @pagination(mode='cursor')
+    @payload('user', list=True)
+    def friends(self, **kwargs):
+        """friends(*, user_id, screen_name, cursor, count, skip_status, \
+                   include_user_entities)
+
+        Returns a user's friends ordered in which they were added 100 at a
+        time. If no user is specified 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-friends-list
+        """
+        return self.request(
+            'GET', 'friends/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
@@ -1765,18 +1792,6 @@ class API:
             user_id=list_to_csv(user_id), **kwargs
         )
 
-    @pagination(mode='cursor')
-    @payload('user', list=True)
-    def friends(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friends-list
-        """
-        return self.request(
-            'GET', 'friends/list', endpoint_parameters=(
-                'user_id', 'screen_name', 'cursor', 'count', 'skip_status',
-                'include_user_entities'
-            ), **kwargs
-        )
-
     @pagination(mode='cursor')
     @payload('ids')
     def friendships_incoming(self, **kwargs):