From: Harmon Date: Wed, 7 Apr 2021 18:40:49 +0000 (-0500) Subject: Update and improve documentation for API.get_user X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ad257ccfc7bd1763b2ff868869b8485bba419f4f;p=tweepy.git Update and improve documentation for API.get_user Automatically use docstring for documentation Improve method and documentation order Add include_entities parameter to documentation Remove id parameter from documentation --- diff --git a/docs/api.rst b/docs/api.rst index 5c0706b..b8a601b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -133,20 +133,12 @@ Follow, search, and get users .. automethod:: API.search_users +.. automethod:: API.get_user + User methods ------------ -.. method:: API.get_user(id/user_id/screen_name) - - Returns information about the specified user. - - :param id: |uid| - :param user_id: |user_id| - :param screen_name: |screen_name| - :rtype: :class:`User` object - - .. method:: API.me() Returns the authenticated user's information. diff --git a/tweepy/api.py b/tweepy/api.py index 229e399..47592e6 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1656,6 +1656,26 @@ class API: ), q=q, **kwargs ) + @payload('user') + def get_user(self, **kwargs): + """get_user(*, user_id, screen_name, include_entities) + + Returns information about the specified user. + + :param user_id: |user_id| + :param screen_name: |screen_name| + :param include_entities: |include_entities| + + :rtype: :class:`User` object + + :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-show + """ + return self.request( + 'GET', 'users/show', endpoint_parameters=( + 'user_id', 'screen_name', 'include_entities' + ), **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 @@ -1823,16 +1843,6 @@ class API: ), command='STATUS', media_id=media_id, upload_api=True, **kwargs ) - @payload('user') - def get_user(self, **kwargs): - """ :reference: https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/follow-search-get-users/api-reference/get-users-show - """ - return self.request( - 'GET', 'users/show', endpoint_parameters=( - 'user_id', 'screen_name', 'include_entities' - ), **kwargs - ) - def me(self): """ Get the authenticated user """ return self.get_user(screen_name=self.auth.get_username())