Update and improve documentation for API.retweets
authorHarmon <Harmon758@gmail.com>
Tue, 6 Apr 2021 23:17:57 +0000 (18:17 -0500)
committerHarmon <Harmon758@gmail.com>
Tue, 6 Apr 2021 23:17:57 +0000 (18:17 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add documentation for trim_user parameter
Use substitution for count parameter documentation
Improve capitalization

docs/api.rst
tweepy/api.py

index ef35b96295fcb5646d7bf0922f186cb4d79f99d1..45d19bd1d0d78b3a15345b45021f738af2f38f13 100644 (file)
@@ -39,6 +39,8 @@ Post, retrieve, and engage with Tweets
 
 .. automethod:: API.retweeters
 
+.. automethod:: API.retweets
+
 .. method:: API.retweets_of_me([since_id], [max_id], [count], [page])
 
    Returns the 20 most recent tweets of the authenticated user that have been
@@ -187,15 +189,6 @@ Status methods
    :rtype: :class:`Status` object
 
 
-.. method:: API.retweets(id, [count])
-
-   Returns up to 100 of the first retweets of the given tweet.
-
-   :param id: |sid|
-   :param count: Specifies the number of retweets to retrieve.
-   :rtype: list of :class:`Status` objects
-
-
 .. method:: API.unretweet(id)
 
    Untweets a retweeted status. Requires the id of the retweet to unretweet.
index 895282a23524f2c9db2291e1b85292f768e6949c..9e2af5ac98a88a06a6f3b19cdf6e72e17b40ca2f 100644 (file)
@@ -491,6 +491,26 @@ class API:
             ), id=id, **kwargs
         )
 
+    @payload('status', list=True)
+    def retweets(self, id, **kwargs):
+        """retweets(id, *, count, trim_user)
+
+        Returns up to 100 of the first Retweets of the given Tweet.
+
+        :param id: |sid|
+        :param count: |count|
+        :param trim_user: |trim_user|
+
+        :rtype: list of :class:`Status` objects
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-retweets-id
+        """
+        return self.request(
+            'GET', f'statuses/retweets/{id}', endpoint_parameters=(
+                'count', 'trim_user'
+            ), **kwargs
+        )
+
     @pagination(mode='id')
     @payload('status', list=True)
     def retweets_of_me(self, **kwargs):
@@ -743,16 +763,6 @@ class API:
             ), **kwargs
         )
 
-    @payload('status', list=True)
-    def retweets(self, id, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/get-statuses-retweets-id
-        """
-        return self.request(
-            'GET', f'statuses/retweets/{id}', endpoint_parameters=(
-                'count', '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