bluesky_queueserver_api.http.REManagerAPI.whoami

REManagerAPI.whoami(*, token=None, api_key=None)

Returns full information about the principal. The principal is identified based on the default authorization key (set by REManagerAPI.set_authorization_key() or as a result of login) or the token or the API key passed as parameters. The returned information includes the list of identities, API keys and sessions for the principal.

Parameters:
token, api_key: str or None, optional

Access token or an API key. The parameters are mutually exclusive: the API fails if both parameters are not None. A token or an API key overrides the default authentication key. Default: None.

Returns:
dict

Information on the authorized principal. See the example in the API description.

Raises:
RequestParameterError

Incorrect or insufficient parameters in the API call.

HTTPRequestError, HTTPClientError, HTTPServerError

Error while sending and processing HTTP request.

Examples

Log into the server and call REManagerAPI.whoami():

RM.login("bob", password="bob_password")
result = RM.whoami()

# {'uuid': '352cae89-7e94-45be-a405-c39099ebe515',
#  'type': 'user',
#  'identities': [
#     {'id': 'bob',
#       'provider': 'toy',
#       'latest_login': '2022-10-02T02:47:57'}],
#   'api_keys': [],
#   'sessions': [{'uuid': 'e544d4b6-4750-43c3-8ba0-b7e9aedd2045',
#                 'expiration_time': '2023-10-01T19:28:15',
#                 'revoked': False},
#                {'uuid': '66ee49c1-32b4-4778-8502-205e35151736',
#                 'expiration_time': '2023-10-01T19:30:03',
#                 'revoked': False},
#       .....................................................
#                {'uuid': 'c41d2f01-607e-49c0-9b3e-a93c383330c0',
#                 'expiration_time': '2023-10-02T02:47:57',
#                 'revoked': False}],
#   'latest_activity': '2022-10-02T02:47:57',
#   'roles': [],
#   'scopes': [],
#   'api_key_scopes': None}