From e7ca2886130fac747ab6701de5e9e30efc3b4061 Mon Sep 17 00:00:00 2001 From: Luis Tejero Date: Tue, 26 May 2020 21:10:01 +0100 Subject: [PATCH] Improvements to Relationship Model and documentation for API.lookup_friendships --- docs/api.rst | 12 ++++++++++++ tweepy/models.py | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 3c43335..7590875 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -468,6 +468,18 @@ 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 + + .. method:: API.friends_ids(id/screen_name/user_id, [cursor]) Returns an array containing the IDs of users being followed by the specified diff --git a/tweepy/models.py b/tweepy/models.py index 0362067..cbb5b9c 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -399,6 +399,10 @@ class Relationship(Model): if k == 'connections': setattr(result, 'is_following', 'following' in v) setattr(result, 'is_followed_by', 'followed_by' in v) + setattr(result, 'is_muted', 'muting' in v) + setattr(result, 'is_blocked', 'blocking' in v) + setattr(result, 'is_following_requested', 'following_requested' in v) + setattr(result, 'no_relationship', 'none' in v) else: setattr(result, k, v) return result -- 2.25.1