Add API.update_friendship
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 19:03:30 +0000 (14:03 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 19:03:30 +0000 (14:03 -0500)
docs/api.rst
tweepy/api.py

index d7346552c1903edd9561664d72979c7413c74c2f..8b1743e7c39a248927b39602eafae38bddb5e961 100644 (file)
@@ -139,6 +139,8 @@ Follow, search, and get users
 
 .. automethod:: API.destroy_friendship
 
+.. automethod:: API.update_friendship
+
 
 Direct Message Methods
 ----------------------
index 6f213947a6f138cfce12f3055ba5d29351196561..602e34d6955ba1a8a392a4457ad7b9106672ed6d 100644 (file)
@@ -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