Update and improve documentation for API.get_user
authorHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 18:40:49 +0000 (13:40 -0500)
committerHarmon <Harmon758@gmail.com>
Wed, 7 Apr 2021 18:40:49 +0000 (13:40 -0500)
Automatically use docstring for documentation
Improve method and documentation order
Add include_entities parameter to documentation
Remove id parameter from documentation

docs/api.rst
tweepy/api.py

index 5c0706b822c98b83c62213dd4f39417bfc8b7331..b8a601b2107288b3174788d08494933e0d06c5ba 100644 (file)
@@ -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.
index 229e399dbe2330c1a413e180e3684b5ad50f5c26..47592e616b50351750a46f03bb3efff67e3cf5a9 100644 (file)
@@ -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())