From cbe9eb32d882032e7a05b70b6e8e239759161bf8 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 7 Apr 2021 11:16:52 -0500 Subject: [PATCH] Update and improve documentation for API.followers_ids Automatically use docstring for documentation Improve method and documentation order Add API documentation header to match API reference index Add cursor and count parameters to documentation Remove id parameter from documentation Improve parameter order in documentation --- docs/api.rst | 16 +++++----------- tweepy/api.py | 36 +++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index c9c4002..1e9f5b7 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -108,6 +108,11 @@ Create and manage lists .. automethod:: API.update_list +Follow, search, and get users +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automethod:: API.followers_ids + User methods ------------ @@ -319,17 +324,6 @@ Friendship Methods :rtype: list of Integers -.. method:: API.followers_ids(id/screen_name/user_id) - - Returns an array containing the IDs of users following the specified user. - - :param id: |uid| - :param screen_name: |screen_name| - :param user_id: |user_id| - :param cursor: |cursor| - :rtype: list of Integers - - Account Methods --------------- diff --git a/tweepy/api.py b/tweepy/api.py index 8582333..352d665 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1381,6 +1381,31 @@ class API: ), **kwargs ) + # Follow, search, and get users + + @pagination(mode='cursor') + @payload('ids') + def followers_ids(self, **kwargs): + """followers_ids(*, user_id, screen_name, cursor, count) + + Returns an array containing the IDs of users following the specified + user. + + :param user_id: |user_id| + :param screen_name: |screen_name| + :param cursor: |cursor| + :param count: |count| + + :rtype: list of Integers + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids + """ + return self.request( + 'GET', 'followers/ids', endpoint_parameters=( + 'user_id', 'screen_name', 'cursor', 'count' + ), **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 @@ -1733,17 +1758,6 @@ class API: ), **kwargs ) - @pagination(mode='cursor') - @payload('ids') - def followers_ids(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-followers-ids - """ - return self.request( - 'GET', 'followers/ids', endpoint_parameters=( - 'user_id', 'screen_name', 'cursor', 'count' - ), **kwargs - ) - @pagination(mode='cursor') @payload('user', list=True) def followers(self, **kwargs): -- 2.25.1