From: Harmon Date: Wed, 7 Apr 2021 17:40:48 +0000 (-0500) Subject: Update and improve documentation for API.lookup_friendships X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7bfbf4c1a638b5e0602438b2d229aca17a268cf1;p=tweepy.git Update and improve documentation for API.lookup_friendships 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 --- diff --git a/docs/api.rst b/docs/api.rst index fa3f39c..eefd048 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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 --------------- diff --git a/tweepy/api.py b/tweepy/api.py index 65a65db..a991639 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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):