Add Client.get_me
authorHarmon <Harmon758@gmail.com>
Fri, 7 Jan 2022 07:52:11 +0000 (01:52 -0600)
committerHarmon <Harmon758@gmail.com>
Fri, 7 Jan 2022 07:52:11 +0000 (01:52 -0600)
tweepy/client.py

index 85a400a9139751d5f7f8329cde8d4741b2c63c18..56c8fefa2aa1d16e8d857d238ac8fc3d09b71b46 100644 (file)
@@ -1726,6 +1726,34 @@ class Client:
             ), data_type=User, user_auth=user_auth
         )
 
+    def get_me(self, *, user_auth=False, **params):
+        """get_me(*, expansions, tweet_fields, user_fields)
+
+        Returns information about an authorized user.
+
+        Parameters
+        ----------
+        expansions : Union[List[str], str]
+            :ref:`expansions_parameter`
+        tweet_fields : Union[List[str], str]
+            :ref:`tweet_fields_parameter`
+        user_fields : Union[List[str], str]
+            :ref:`user_fields_parameter`
+
+        Returns
+        -------
+        Union[dict, requests.Response, Response]
+
+        References
+        ----------
+        https://developer.twitter.com/en/docs/twitter-api/users/lookup/api-reference/get-users-me
+        """
+        return self._make_request(
+            "GET", f"/2/users/me", params=params,
+            endpoint_parameters=("expansions", "tweet.fields", "user.fields"),
+            data_type=User, user_auth=user_auth
+        )
+
     # Search Spaces
 
     def search_spaces(self, query, **params):