2 Commits

Author SHA1 Message Date
0e1eb0da3f chore: bump version to v0.5.1 2025-08-19 09:41:57 +02:00
4b81cc7f9f fix: improve JSON response handling in API calls 2025-08-19 09:41:28 +02:00
2 changed files with 7 additions and 9 deletions

View File

@@ -331,7 +331,7 @@ def get_schedule(num_days: int) -> str:
# Debug: Save raw response to file for analysis
# with open("raw_response.txt", "w") as f:
# f.write(r.text)
return r.text
return json.loads(sanitize_json_response(r.text))
@wrapper_session
@@ -383,13 +383,11 @@ def schedule(
"""
global global_config_section
schedule = get_schedule(num_days)
# Sanitize the JSON response using our proven approach
sanitized_schedule = sanitize_json_response(schedule)
if outfile:
with outfile.open("w") as f:
f.write(sanitized_schedule)
f.write(json.dumps(schedule))
else:
print(sanitized_schedule)
print(json.dumps(schedule, indent=2))
def os_open(file: str) -> None:
@@ -607,7 +605,7 @@ def refresh_data():
# verify=False,
) as r:
r.raise_for_status()
return r.json()
return json.loads(sanitize_json_response(r.text))
@app.command("mobile-login")
@@ -633,7 +631,6 @@ def mobile_game(
global userdata, global_config_section
userdata = mobile_login(config_section=global_config_section)
# data = refresh_data()
with requests.post(
"https://app.myice.hockey/api/mobilerest/getevent",
headers=mobile_headers,
@@ -649,7 +646,8 @@ def mobile_game(
),
# verify=False,
) as r:
data = r.json()["eventData"]
data = json.loads(sanitize_json_response(r.text))["eventData"]
players = data["convocation"]["available"]
if raw:
print(data)

View File

@@ -1,6 +1,6 @@
[project]
name = "myice"
version = "v0.5.0"
version = "v0.5.1"
description = "myice parsing"
authors = [
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},