Update and improve documentation for API.lookup_friendships
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 17:40:48 +0000 (12:40 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 17:40:48 +0000 (12:40 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Update parameter names in documentation
Improve parameter order in documentation
Fix return type in documentation

docs/api.rst
tweepy/api.py

index fa3f39c35062459313d0f5e78f640e19b8fe3071..eefd048eff7bbf7b2012c34a34325c85aa115338 100644 (file)
@@ -121,6 +121,8 @@ Follow, search, and get users
 
 .. automethod:: API.friendships_incoming
 
+.. automethod:: API.lookup_friendships
+
 
 User methods
 ------------
@@ -277,18 +279,6 @@ Friendship Methods
    :rtype: :class:`Friendship` object
 
 
-.. method:: API.lookup_friendships(user_ids/screen_names)
-
-   Returns the relationships of the authenticated user to the list of up to
-   100 screen_names or user_ids provided.
-
-   :param user_ids: A list of user IDs, up to 100 are allowed in a single
-                    request.
-   :param screen_names: A list of screen names, up to 100 are allowed in a
-                        single request.
-   :rtype: :class:`Relationship` object
-
-
 Account Methods
 ---------------
 
index 65a65db7a0dde28227ed3be201ae5ee25249c6b3..a991639a9299e5476f088e626e50ce2cfc5f56cb 100644 (file)
@@ -1506,6 +1506,29 @@ class API:
             ), **kwargs
         )
 
+    @payload('relationship', list=True)
+    def lookup_friendships(self, *, screen_name=None, user_id=None, **kwargs):
+        """lookup_friendships(*, screen_name, user_id)
+
+        Returns the relationships of the authenticated user to the list of up
+        to 100 screen_name or user_id provided.
+
+        :param screen_name: A list of screen names, up to 100 are allowed in a
+                            single request.
+        :param user_id: A list of user IDs, up to 100 are allowed in a single
+                        request.
+
+        :rtype: list of :class:`Relationship` objects
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup
+        """
+        return self.request(
+            'GET', 'friendships/lookup', endpoint_parameters=(
+                'screen_name', 'user_id'
+            ), screen_name=list_to_csv(screen_name),
+            user_id=list_to_csv(user_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
@@ -1802,17 +1825,6 @@ class API:
             ), **kwargs
         )
 
-    @payload('relationship', list=True)
-    def lookup_friendships(self, *, screen_name=None, user_id=None, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-friendships-lookup
-        """
-        return self.request(
-            'GET', 'friendships/lookup', endpoint_parameters=(
-                'screen_name', 'user_id'
-            ), screen_name=list_to_csv(screen_name),
-            user_id=list_to_csv(user_id), **kwargs
-        )
-
     @pagination(mode='cursor')
     @payload('ids')
     def friendships_outgoing(self, **kwargs):