Skip to content

Commit

Permalink
Merge pull request #32 from klejejs/fix/auth-settings-parsing
Browse files Browse the repository at this point in the history
Fix settings parsing during auth
  • Loading branch information
klejejs authored Apr 30, 2024
2 parents 7578d3e + 2238c44 commit 1aef523
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions ThermiaOnlineAPI/api/ThermiaAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,10 @@ def __authenticate(self) -> bool:
csrf_token = ""

if request_auth.status_code == 200:
settings_string = [
i
for i in request_auth.text.splitlines()
if i.startswith("var SETTINGS = ")
]
settings_string = request_auth.text.split("var SETTINGS = ")
settings_string = settings_string[1].split("};")[0] + "}"
if len(settings_string) > 0:
settings = json.loads(settings_string[0][15:-1])

settings = json.loads(settings_string)
state_code = str(settings["transId"]).split("=")[1]
csrf_token = settings["csrf"]
else:
Expand Down

0 comments on commit 1aef523

Please sign in to comment.