From abd7a9e5651191df21f3686ddb851ad96a2777a8 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 21 Nov 2023 14:27:00 -0500 Subject: [PATCH] add tweet pin/unpin functions --- tweepy/api.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tweepy/api.py b/tweepy/api.py index 37caf07..2072ac6 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -2543,6 +2543,36 @@ class API: 'GET', 'account/settings', use_cache=False, **kwargs ) + def pin_tweet(self, id, **kwargs): + """pin_tweet(*, id) + + Pin a tweet on your account. + + References + ---------- + + As of 2023-11-21, this endpoint is not listed in twitter's api documentation. + """ + + return self.request( + 'POST', 'account/pin_tweet', endpoint_parameters=('tweet_mode', 'id'), tweet_mode='extended', id=id, **kwargs + ) + + def unpin_tweet(self, id, **kwargs): + """pin_tweet(*, id) + + Unpin a tweet on your account + + References + ---------- + + As of 2023-11-21, this endpoint is not listed in twitter's api documentation. + """ + + return self.request( + 'POST', 'account/unpin_tweet', endpoint_parameters=('tweet_mode', 'id'), tweet_mode='extended', id=id, **kwargs + ) + @payload('user') def verify_credentials(self, **kwargs): """verify_credentials(*, include_entities, skip_status, include_email) -- 2.25.1