NotebookAuth

class lsst_efd_client.NotebookAuth(path='~/.lsst/notebook_auth.yaml', env_var=None, auth_dict=None)

Bases: object

Class to help keep authentication credentials secret.

Credentials can be passed directly in a dictionary, the name of an environment variable that contains the path to the credentials file may be passed, or a path to the file may be passed directly. The credential location is checked in that order.

Parameters:
path : str, optional

Path to thuse when reading credentials from disk (‘~/.lsst/notebook_auth.yaml’ by default).

env_var : str, optional

Name of an environment variable to check for the path to the credentials file (None by default).

auth_dict : dict, optional

Dictionary of dictionaries of credentials. Each key is the name of a potential authenticator. The credential dictionaries must have the following keys: ‘host’, ‘username’, and ‘password’. This is None by default.

Raises:
ValueError

Raised if auth_dict, env_var, and path are all None.

IOError

Raised if either the credentials file has the wrong permissions or if the file fails to load.

Methods Summary

get_auth(alias) Return the credentials as a tuple

Methods Documentation

get_auth(alias)

Return the credentials as a tuple

Parameters:
alias : str

Name of the authenticator.

Returns:
credentials : tuple

A tuple containing the host name, user name, and password.