Update and improve documentation for API.report_spam
authorHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 15:27:06 +0000 (10:27 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 15:27:06 +0000 (10:27 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Remove id parameter from documentation
Update method/endpoint documentation

docs/api.rst
tweepy/api.py

index 92e15da192e7990a59de394b159cc01d19cd0899..ffb53917d9994c23871c270b51051d25e339b5a9 100644 (file)
@@ -187,6 +187,8 @@ Mute, block, and report users
 
 .. automethod:: API.destroy_mute
 
+.. automethod:: API.report_spam
+
 
 Direct Message Methods
 ----------------------
@@ -258,22 +260,6 @@ Account Methods
    :rtype: :class:`JSON` object
 
 
-Spam Reporting Methods
-----------------------
-
-.. method:: API.report_spam(id/screen_name/user_id, [perform_block])
-
-   The user specified in the id is blocked by the authenticated user and
-   reported as a spammer.
-
-   :param id: |uid|
-   :param screen_name: |screen_name|
-   :param user_id: |user_id|
-   :param perform_block: A boolean indicating if the reported account should be
-                         blocked. Defaults to True.
-   :rtype: :class:`User` object
-
-
 Search Methods
 --------------
 
index ac63baba90b64e189969f32553bf93f79d842fac..138cbc73894e48f14c9b33c029005f785e5f61f9 100644 (file)
@@ -2178,6 +2178,27 @@ class API:
             ), **kwargs
         )
 
+    @payload('user')
+    def report_spam(self, **kwargs):
+        """report_spam(*, screen_name, user_id, perform_block)
+
+        Report the specified user as a spam account to Twitter.
+
+        :param screen_name: |screen_name|
+        :param user_id: |user_id|
+        :param perform_block: A boolean indicating if the reported account
+                              should be blocked. Defaults to True.
+
+        :rtype: :class:`User` object
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam
+        """
+        return self.request(
+            'POST', 'users/report_spam', endpoint_parameters=(
+                'screen_name', 'user_id', 'perform_block'
+            ), **kwargs
+        )
+
     def media_upload(self, filename, *, file=None, chunked=False,
                      media_category=None, additional_owners=None, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/overview
@@ -2417,16 +2438,6 @@ class API:
             ), use_cache=False, **kwargs
         )
 
-    @payload('user')
-    def report_spam(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/post-users-report_spam
-        """
-        return self.request(
-            'POST', 'users/report_spam', endpoint_parameters=(
-                'screen_name', 'user_id', 'perform_block'
-            ), **kwargs
-        )
-
     @payload('json')
     def trends_available(self, **kwargs):
         """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/trends/locations-with-trending-topics/api-reference/get-trends-available