From: Harmon Date: Sat, 10 Apr 2021 14:45:16 +0000 (-0500) Subject: Update and improve documentation for API.blocks X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1c9d9f413f6b1e26bf5a40a8b864a89f1a738b7a;p=tweepy.git Update and improve documentation for API.blocks 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 --- diff --git a/docs/api.rst b/docs/api.rst index 7d24ce6..4ad44d2 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -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 ------------ diff --git a/tweepy/api.py b/tweepy/api.py index 67ba279..ea30b74 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -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