bluesky_queueserver_api.http.REManagerAPI.login

REManagerAPI.login(username=None, *, password=None, provider=None)
Parameters:
username: str, optional

Login username. If the parameter is omitted or None, then the function asks for the username interactively.

password: str, optional

Login password. If the parameter is omitted or None, the the function asks of the password interactively.

Note

Passwords should never be explicitly included in Python scripts or typed as API parameters in IPython environment. Use interactive input (manual entry, preferable) or environment variables to pass passwords. For example, the following script is using password contained in the environment variable MY_PASSWORD. If the environment variable is not set, then the script is interactively asking for the password:

...
username = "bob"
RM.login(username, password=os.environ.get("MY_PASSWORD", None))
...

Starting the script from command line:

$ MY_PASSWORD=bob_password python experiment.py
provider: str or None

The endpoint of the authentication provider (e.g. ‘/toy/token’). The passed value overrides the default provider (set by passing http_auth_provider to the constructor of REManagerAPI). Setting the default provider is preferable for interactive IPython-based workflows. Default: None.

Returns:
dict

Dictionary with the following keys:

  • access_token (str) - access token.

  • expires_in (float) - life time of the token in seconds.

  • refresh_token (str) - refresh token.

  • refresh_token_expires_in (str) - life time of the refresh token in seconds.

  • token_type (str) - 'bearer'.

Raises:
RequestParameterError

Incorrect or insufficient parameters in the API call.

HTTPRequestError, HTTPClientError, HTTPServerError

Error while sending and processing HTTP request.