Update and improve documentation for API.blocks
authorHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 14:45:16 +0000 (09:45 -0500)
committerHarmon <Harmon758@gmail.com>
Sat, 10 Apr 2021 14:45:23 +0000 (09:45 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add include_entities, skip_status, and cursor parameters to documentation
Remove page parameter from documentation

docs/api.rst
tweepy/api.py

index 7d24ce641716605e09168f70c35e3f943f001f4b..4ad44d2694e13109ffe63a5351f73543ca610eb8 100644 (file)
@@ -173,6 +173,8 @@ Mute, block, and report users
 
 .. automethod:: API.blocks_ids
 
+.. automethod:: API.blocks
+
 
 Direct Message Methods
 ----------------------
@@ -269,14 +271,6 @@ Block Methods
    :rtype: :class:`User` object
 
 
-.. method:: API.blocks([page])
-
-   Returns an array of user objects that the authenticating user is blocking.
-
-   :param page: |page|
-   :rtype: list of :class:`User` objects
-
-
 Mute Methods
 ------------
 
index 67ba2795dede309578b0e1efbe90916e473cc12e..ea30b749ea57b283aeb7996c9838d9d5ed34698c 100644 (file)
@@ -2028,6 +2028,28 @@ class API:
             ), **kwargs
         )
 
+    @pagination(mode='cursor')
+    @payload('user', list=True)
+    def blocks(self, **kwargs):
+        """blocks(*, include_entities, skip_status, cursor)
+
+        Returns an array of user objects that the authenticating user is
+        blocking.
+
+        :param include_entities: |include_entities|
+        :param skip_status: |skip_status|
+        :param cursor: |cursor|
+
+        :rtype: list of :class:`User` objects
+
+        :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list
+        """
+        return self.request(
+            'GET', 'blocks/list', endpoint_parameters=(
+                'include_entities', 'skip_status', 'cursor'
+            ), **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
@@ -2329,17 +2351,6 @@ class API:
             ), **kwargs
         )
 
-    @pagination(mode='cursor')
-    @payload('user', list=True)
-    def blocks(self, **kwargs):
-        """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/mute-block-report-users/api-reference/get-blocks-list
-        """
-        return self.request(
-            'GET', 'blocks/list', endpoint_parameters=(
-                'include_entities', 'skip_status', 'cursor'
-            ), **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