fix: webapi schedule uses mobile api endpoint
This commit is contained in:
+10
-3
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user