From: Harmon Date: Wed, 7 Apr 2021 13:39:41 +0000 (-0500) Subject: Update and improve documentation for API.unretweet X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c91340ae7274ca4535fc26d4587581910230cc05;p=tweepy.git Update and improve documentation for API.unretweet Automatically use docstring for documentation Improve method and documentation order Add documentation for trim_user parameter Improve capitalization --- diff --git a/docs/api.rst b/docs/api.rst index f851b6a..af40262 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -53,6 +53,8 @@ Post, retrieve, and engage with Tweets .. automethod:: API.retweet +.. automethod:: API.unretweet + Status methods -------------- @@ -155,14 +157,6 @@ Status methods :rtype: :class:`Status` object -.. method:: API.unretweet(id) - - Untweets a retweeted status. Requires the id of the retweet to unretweet. - - :param id: |sid| - :rtype: :class:`Status` object - - User methods ------------ diff --git a/tweepy/api.py b/tweepy/api.py index ef8e5a6..aa89068 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -645,6 +645,26 @@ class API: ), **kwargs ) + @payload('status') + def unretweet(self, id, **kwargs): + """unretweet(id, *, trim_user) + + Untweets a retweeted status. Requires the ID of the retweet to + unretweet. + + :param id: |sid| + :param trim_user: |trim_user| + + :rtype: :class:`Status` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id + """ + return self.request( + 'POST', f'statuses/unretweet/{id}', endpoint_parameters=( + 'trim_user', + ), **kwargs + ) + @payload('status') def update_status(self, status, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update @@ -844,16 +864,6 @@ class API: ), command='STATUS', media_id=media_id, upload_api=True, **kwargs ) - @payload('status') - def unretweet(self, id, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-unretweet-id - """ - return self.request( - 'POST', f'statuses/unretweet/{id}', endpoint_parameters=( - 'trim_user', - ), **kwargs - ) - @payload('user') def get_user(self, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-show