Added an authentication manager for handling credentials
This commit is contained in:
parent
ac4a90edd1
commit
944ba9791b
1 changed files with 25 additions and 0 deletions
25
auth_manager.py
Normal file
25
auth_manager.py
Normal file
|
|
@ -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()
|
||||||
Loading…
Reference in a new issue