Skip to content

Commit

Permalink
Update and improve documentation for API.followers_ids
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Harmon758 committed Apr 7, 2021
1 parent ae9ba0e commit cbe9eb3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 22 deletions.
16 changes: 5 additions & 11 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ Create and manage lists

.. automethod:: API.update_list

Follow, search, and get users
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automethod:: API.followers_ids


User methods
------------
Expand Down Expand Up @@ -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
---------------

Expand Down
36 changes: 25 additions & 11 deletions tweepy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,31 @@ def update_list(self, **kwargs):
), **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
Expand Down Expand Up @@ -1733,17 +1758,6 @@ def friendships_outgoing(self, **kwargs):
), **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):
Expand Down

0 comments on commit cbe9eb3

Please sign in to comment.