From 9ac550923ee8eeddffb4011397344f619ee7f609 Mon Sep 17 00:00:00 2001 From: Andreas Sauerwein-Schlosser Date: Sun, 28 Apr 2024 12:14:26 +0200 Subject: [PATCH] write access token to variable after refresh --- download_v2.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/download_v2.py b/download_v2.py index 755398f..36dd564 100755 --- a/download_v2.py +++ b/download_v2.py @@ -216,6 +216,7 @@ def compare_refresh_token(): def refresh_token(): + global ACCESS_TOKEN if HOMEASSISTANT: compare_token() # check if current token expires in less than 2 hours @@ -233,6 +234,7 @@ def refresh_token(): } result = base_req(url, method="post", json=payload) ACCESS_TOKEN_PATH.write_text(result["access_token"]) + ACCESS_TOKEN = result["access_token"] logger.info("Sucesfully refreshed token") else: # token is valid for mor then 2 hours