def get_user_info()

in dell_ai/auth.py [0:0]


def get_user_info(token: Optional[str] = None) -> Dict[str, Any]:
    """
    Get information about the authenticated user.

    Args:
        token: The Hugging Face token to use. If not provided, will use the
               token from get_token().

    Returns:
        A dictionary with user information

    Raises:
        AuthenticationError: If authentication fails or no token is available
    """
    token = token or get_token()
    if not token:
        raise AuthenticationError("No authentication token found. Please login first.")

    try:
        return whoami(token=token)
    except Exception as e:
        raise AuthenticationError(f"Failed to get user information: {str(e)}")