Skip to content

Commit

Permalink
write access token to variable after refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
asauerwein-nts committed Apr 28, 2024
1 parent 6d60e01 commit 9ac5509
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions download_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9ac5509

Please sign in to comment.