From: Harmon Date: Wed, 7 Apr 2021 19:03:30 +0000 (-0500) Subject: Add API.update_friendship X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ddd24a474305d2a9916d92e64b2821a27a6ef450;p=tweepy.git Add API.update_friendship --- diff --git a/docs/api.rst b/docs/api.rst index d734655..8b1743e 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -139,6 +139,8 @@ Follow, search, and get users .. automethod:: API.destroy_friendship +.. automethod:: API.update_friendship + Direct Message Methods ---------------------- diff --git a/tweepy/api.py b/tweepy/api.py index 6f21394..602e34d 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1716,6 +1716,27 @@ class API: ), **kwargs ) + @payload('friendship') + def update_friendship(self, **kwargs): + """update_friendship(*, screen_name, user_id, device, retweets) + + Turn on/off Retweets and device notifications from the specified user. + + :param screen_name: |screen_name| + :param user_id: |user_id| + :param device: Turn on/off device notifications from the target user. + :param retweets: Turn on/off Retweets from the target user. + + :rtype: :class:`Friendship` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/post-friendships-update + """ + return self.request( + 'POST', 'friendships/update', endpoint_parameters=( + 'screen_name', 'user_id', 'device', 'retweets' + ), **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