From f10a5cfee66d6ea3d14879140ebb718bf60ab7b8 Mon Sep 17 00:00:00 2001 From: kingbri Date: Sun, 4 Feb 2024 01:56:42 -0500 Subject: [PATCH] Auth: Create keys on different exception FileNotFoundError is the proper exception to catch here rather than OSError. Signed-off-by: kingbri --- common/auth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/auth.py b/common/auth.py index ea42168..7c3975f 100644 --- a/common/auth.py +++ b/common/auth.py @@ -59,7 +59,7 @@ def load_auth_keys(disable_from_config: bool): with open("api_tokens.yml", "r", encoding="utf8") as auth_file: auth_keys_dict = yaml.safe_load(auth_file) AUTH_KEYS = AuthKeys.model_validate(auth_keys_dict) - except OSError: + except FileNotFoundError: new_auth_keys = AuthKeys( api_key=secrets.token_hex(16), admin_key=secrets.token_hex(16) )