From f903f5ff31a8044a4a29007b36e0fb4e50d4a2fc Mon Sep 17 00:00:00 2001 From: extreme4all <40169115+extreme4all@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:47:20 +0100 Subject: [PATCH] bug fixes --- api/app.py | 6 ++++-- api/cogs/requests.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/api/app.py b/api/app.py index a62c7a3..b195147 100644 --- a/api/app.py +++ b/api/app.py @@ -68,10 +68,12 @@ async def manual_startup(secret: str): logger.info("new day") id, today = 0, date.today() - hiscores = await req.get_prediction_data(id=id, limit=config.BATCH_AMOUNT) + hiscores = await req.get_prediction_data( + player_id=id, limit=config.BATCH_AMOUNT + ) _highscores = hiscores[-1] logger.info(_highscores) - id = _highscores.get("id") + id = _highscores.get("Player_id") hiscores = pd.DataFrame(hiscores) if len(hiscores) == 0: diff --git a/api/cogs/requests.py b/api/cogs/requests.py index 269ecef..03c45a6 100644 --- a/api/cogs/requests.py +++ b/api/cogs/requests.py @@ -96,7 +96,7 @@ async def get_player_data(label_id: int, limit: int = 5000): async def get_hiscore_data(label_id: int, limit: int = 5000): url = "http://private-api-svc.bd-prd.svc:5000/v2/highscore/latest" # TODO: fix hardcoded - params = {"player_id": 1, "many": 1, "limit": limit} + params = {"player_id": 1, "label_id": label_id, "many": 1, "limit": limit} # Initialize a list to store hiscore data hiscores = [] @@ -113,14 +113,14 @@ async def get_hiscore_data(label_id: int, limit: int = 5000): break # Increment the page parameter for the next request - params["player_id"] = data[-1]["id"] + params["player_id"] = data[-1]["Player_id"] return hiscores -async def get_prediction_data(id: int = 0, limit: int = 0): +async def get_prediction_data(player_id: int = 0, limit: int = 0): url = "http://private-api-svc.bd-prd.svc:5000/v2/highscore/latest" # TODO: fix hardcoded - params = {"player_id": id, "many": 1, "limit": limit} + params = {"player_id": player_id, "many": 1, "limit": limit} data = await retry_request(url=url, params=params) return data