Skip to content

User

Module with the user endpoint

User (Endpoint)

User endpoint

Source code in async_spotify/api/_endpoints/user.py
class User(Endpoint):
    """
    User endpoint
    """

    async def me(self, auth_token: SpotifyAuthorisationToken = None) -> dict:
        """
        Get detailed profile information about the current user (including the current user’s username).

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/](https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/)

        Args:
            auth_token: The auth token if you set the api class not to keep the token in memory

        Returns:
            The Current User's Profile
        """

        return await self.api_request_handler.make_request('GET', URLS.USER.ME, {}, auth_token)

    async def get_one(self, user_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
        """
        Get detailed profile information about a user (including the current user’s username).

        Notes:
            [https://developer.spotify.com/documentation/web-api/reference/users-profile/get-users-profile/](https://developer.spotify.com/documentation/web-api/reference/users-profile/get-users-profile/)

        Args:
            user_id: The user’s Spotify user ID.
            auth_token: The auth token if you set the api class not to keep the token in memory

        Returns:
            The Current User's Profile
        """

        url, _ = self._add_url_params(URLS.USER.USER, {'user_id': user_id})
        return await self.api_request_handler.make_request('GET', url, {}, auth_token)

get_one(self, user_id, auth_token=None) async

Get detailed profile information about a user (including the current user’s username).

Parameters:

Name Type Description Default
user_id str

The user’s Spotify user ID.

required
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None

Returns:

Type Description
dict

The Current User's Profile

Source code in async_spotify/api/_endpoints/user.py
async def get_one(self, user_id: str, auth_token: SpotifyAuthorisationToken = None) -> dict:
    """
    Get detailed profile information about a user (including the current user’s username).

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/users-profile/get-users-profile/](https://developer.spotify.com/documentation/web-api/reference/users-profile/get-users-profile/)

    Args:
        user_id: The user’s Spotify user ID.
        auth_token: The auth token if you set the api class not to keep the token in memory

    Returns:
        The Current User's Profile
    """

    url, _ = self._add_url_params(URLS.USER.USER, {'user_id': user_id})
    return await self.api_request_handler.make_request('GET', url, {}, auth_token)

me(self, auth_token=None) async

Get detailed profile information about the current user (including the current user’s username).

Parameters:

Name Type Description Default
auth_token SpotifyAuthorisationToken

The auth token if you set the api class not to keep the token in memory

None

Returns:

Type Description
dict

The Current User's Profile

Source code in async_spotify/api/_endpoints/user.py
async def me(self, auth_token: SpotifyAuthorisationToken = None) -> dict:
    """
    Get detailed profile information about the current user (including the current user’s username).

    Notes:
        [https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/](https://developer.spotify.com/documentation/web-api/reference/users-profile/get-current-users-profile/)

    Args:
        auth_token: The auth token if you set the api class not to keep the token in memory

    Returns:
        The Current User's Profile
    """

    return await self.api_request_handler.make_request('GET', URLS.USER.ME, {}, auth_token)

Last update: April 27, 2020