From e319933c74c5326a85aff7ee8631ef08653c95bb Mon Sep 17 00:00:00 2001 From: Punit Arani Date: Sun, 28 Jul 2024 13:58:40 -0700 Subject: [PATCH] Fix download_schwab_token() to return after token write --- server/load.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/load.py b/server/load.py index 8e95c44..a5ecd25 100644 --- a/server/load.py +++ b/server/load.py @@ -11,11 +11,13 @@ def download_schwab_token() -> None: schwab_token = os.getenv("SCHWAB_TOKEN", None) + if schwab_token is None: + raise ValueError("SCHWAB_TOKEN environment variable not set") + if schwab_token is not None: with open(SCHWAB_TOKEN_FP, "w") as f: f.write(schwab_token) - - raise ValueError("SCHWAB_TOKEN environment variable not set") + return async def load_models():