From: Harmon Date: Tue, 6 Apr 2021 23:50:16 +0000 (-0500) Subject: Update and improve documentation for API.create_favorite X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=86337e330cf91db7b4b2c2faea87a517567697b5;p=tweepy.git Update and improve documentation for API.create_favorite Automatically use docstring for documentation Improve method and documentation order Add documentation for include_entities parameter Improve formatting and capitalization of reference --- diff --git a/docs/api.rst b/docs/api.rst index 64d9da0..3997d8b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -45,6 +45,8 @@ Post, retrieve, and engage with Tweets .. automethod:: API.get_status +.. automethod:: API.create_favorite + Status methods -------------- @@ -444,15 +446,6 @@ Account Methods Favorite Methods ---------------- -.. method:: API.create_favorite(id) - - Favorites the status specified in the ID parameter as the authenticating - user. - - :param id: |sid| - :rtype: :class:`Status` object - - .. method:: API.destroy_favorite(id) Un-favorites the status specified in the ID parameter as the authenticating diff --git a/tweepy/api.py b/tweepy/api.py index e8219d5..38e9683 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -566,6 +566,26 @@ class API: ), id=id, **kwargs ) + @payload('status') + def create_favorite(self, id, **kwargs): + """create_favorite(id, *, include_entities) + + Favorites the status specified in the ``id`` parameter as the + authenticating user. + + :param id: |sid| + :param include_entities: |include_entities| + + :rtype: :class:`Status` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-create + """ + return self.request( + 'POST', 'favorites/create', endpoint_parameters=( + 'id', 'include_entities' + ), id=id, **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 @@ -1082,16 +1102,6 @@ class API: ), **kwargs ) - @payload('status') - def create_favorite(self, id, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-create - """ - return self.request( - 'POST', 'favorites/create', endpoint_parameters=( - 'id', 'include_entities' - ), id=id, **kwargs - ) - @payload('status') def destroy_favorite(self, id, **kwargs): """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-favorites-destroy