From 944ba9791b4c132f0c9b6b503ddec7e2511eb1e5 Mon Sep 17 00:00:00 2001 From: Yarne Coppens Date: Wed, 31 Jul 2024 15:15:32 +0200 Subject: [PATCH] Added an authentication manager for handling credentials --- auth_manager.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 auth_manager.py diff --git a/auth_manager.py b/auth_manager.py new file mode 100644 index 0000000..d6bdc2c --- /dev/null +++ b/auth_manager.py @@ -0,0 +1,25 @@ +#Can only be imported on main.py + +import yaml + +username: str = None +password: str = None + +auth_secret_file_location = './secrets/auth.yaml' + +def load_username_password_from_secrets(): + global username + global password + + with open(auth_secret_file_location, 'r') as auth_file: + auth_object = yaml.safe_load(auth_file) + + username = auth_object['username'] + password = auth_object['password'] + + +def get_username_password(): + return username, password + + +load_username_password_from_secrets() \ No newline at end of file