def login(ctx): """Login to the Substra platform.""" usr.Manager(ctx.obj.user).clear_user() client = get_client(ctx.obj) token = client.login() # create temporary user data usr.Manager(ctx.obj.user).add_user(token)
def login(ctx, username, password): """Login to the Substra platform.""" usr.Manager(ctx.obj.user).clear_user() client = get_client(ctx.obj) token = client.login(username, password) # create temporary user data usr.Manager(ctx.obj.user).add_user(token) display(f"Token: {token}")
def __init__(self, config_path=None, profile_name=None, user_path=None): self._cfg_manager = cfg.Manager(config_path or cfg.DEFAULT_PATH) self._usr_manager = usr.Manager(user_path or usr.DEFAULT_PATH) self._current_profile = None self._profiles = {} self.client = rest_client.Client() self._profile_name = 'default' if profile_name: self._profile_name = profile_name self.set_profile(profile_name) # set current logged user if exists self.set_user()
def __init__(self, config_path=None, profile_name=None, user_path=None, token=None, retry_timeout=DEFAULT_RETRY_TIMEOUT): self._cfg_manager = cfg.Manager(config_path or cfg.DEFAULT_PATH) self._usr_manager = usr.Manager(user_path or usr.DEFAULT_PATH) self._current_profile = None self._profiles = {} self.client = rest_client.Client() self._profile_name = 'default' self._retry_timeout = retry_timeout if profile_name: self._profile_name = profile_name self.set_profile(profile_name) # set current logged user if exists self.set_user() if token: self._set_token(token)