bluesky_queueserver_api.http.REManagerAPI.apikey_info

REManagerAPI.apikey_info(*, api_key=None)

Get information about an API key. The API returning information about the API key used to authorize the request. The request fails if a token is used for authorization. If the parameter api_key is None, then the default security key (set by REManagerAPI.set_authorization_key() and must be an API key, not a token) is used. The API key passed with the parameter api_key override the default security key (the default is ignored). This allows to obtain information on any API key without logging out or changing the default security key.

Parameters:
api_key: str or None, optional

API key of interest. The parameter is used for authorization of the request instead of the default security key, which is ignored. Default: None.

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, generate an API key and get the information on the generated API key:

RM.login("bob", password="bob_password")
result_key = RM.apikey_new(expires_in=900)

# {'first_eight': '48b27a85',
#  'expiration_time': '2022-10-02T14:35:59',
#  'note': None,
#  'scopes': ['inherit'],
#  'latest_activity': None,
#  'secret': '48b27a85b71946f7840c6d708dd49a42c8945d8cb36b9bb378a3d93d1e1bd586c5851b84'}

result = RM.apikey_info(api_key=result_key["secret"]

# {'first_eight': '48b27a85',
#  'expiration_time': '2022-10-02T14:35:59',
#  'note': None,
#  'scopes': ['inherit'],
#  'latest_activity': None}