fix: guard missing env vars in authenticate(), drain queues post-yield
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,11 @@ def authenticate() -> str:
|
||||
"""Initiate Garmin authentication using credentials from environment variables."""
|
||||
global _client, _auth_state
|
||||
|
||||
email = os.environ.get("GARMIN_EMAIL", "")
|
||||
password = os.environ.get("GARMIN_PASSWORD", "")
|
||||
if not email or not password:
|
||||
return "GARMIN_EMAIL and GARMIN_PASSWORD environment variables are required."
|
||||
|
||||
def _do_login() -> None:
|
||||
try:
|
||||
_client.login()
|
||||
@@ -57,7 +62,7 @@ def authenticate() -> str:
|
||||
except Exception as exc:
|
||||
_login_result_queue.put(("error", str(exc)))
|
||||
|
||||
_client = Garmin(os.environ.get("GARMIN_EMAIL", ""), os.environ.get("GARMIN_PASSWORD", ""))
|
||||
_client = Garmin(email, password)
|
||||
_client.prompt_mfa = _prompt_mfa
|
||||
threading.Thread(target=_do_login, daemon=True).start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user