from pathlib import Path from typing import Tuple import yaml import streamlit_authenticator as stauth def authenticate(path: Path) -> Tuple[bool, str]: """Function tries to authenticate user and returns True if it succeeds, False if failes along with username""" with open(path) as file: config = yaml.load(file, Loader=yaml.SafeLoader) authenticator = stauth.Authenticate( config["credentials"], config["cookie"]["name"], config["cookie"]["key"], config["cookie"]["expiry_days"], ) _, authentication_status, username = authenticator.login("Login", "main") return authentication_status, username