Update and improve documentation for API.create_favorite
authorHarmon <Harmon758@gmail.com>
Tue, 6 Apr 2021 23:50:16 +0000 (18:50 -0500)
committerHarmon <Harmon758@gmail.com>
Tue, 6 Apr 2021 23:50:16 +0000 (18:50 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add documentation for include_entities parameter
Improve formatting and capitalization of reference

docs/api.rst
tweepy/api.py

index 64d9da04ebf665137fddd96c3f4225f6f0ef182f..3997d8b2e97da9b6c8a44c5a9c8a29f31c4b27e4 100644 (file)
@@ -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
index e8219d530311db72fc1ce8537fb941f97a60cfb1..38e968317fb0247518bf8d9a9252de45c12efe29 100644 (file)
@@ -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