fix: webapi schedule uses mobile api endpoint

This commit is contained in:
2025-03-12 11:46:20 +01:00
parent 251e2b1452
commit 28b34d8281
2 changed files with 12 additions and 5 deletions
+10 -3
View File
@@ -1,4 +1,3 @@
import json
import requests
from typing import Annotated
from fastapi import FastAPI, Header, HTTPException
@@ -45,11 +44,19 @@ async def favico():
@app.get("/schedule")
async def schedule(
headers: Annotated[AuthHeaders, Header()],
num_days: int = 7,
):
if not headers.authorized():
raise HTTPException(401, detail="get out")
return json.loads(myice.get_schedule(num_days))
username, password, userid, existing_token = myice.get_login()
if existing_token:
myice.userdata = {
"id": userid,
"id_club": 186,
"token": existing_token,
}
else:
myice.userdata = myice.mobile_login()
return myice.refresh_data()["club_games"]
@app.get("/game/{game_id}")