Skip to content

Commit

Permalink
some extra error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
extreme4all committed Sep 7, 2024
1 parent b11b11b commit 2f70888
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion api/cogs/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,17 @@ 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]["Player_id"]
last_record = data[-1]
if not isinstance(last_record, dict):
logger.error(f"expected dict but got {type(last_record)}, {last_record=}")
break

last_player_id = data.get("Player_id", None)
if last_player_id is None:
logger.error(f"expected int but got None, {last_record=}")
break

params["player_id"] = last_player_id

return hiscores

Expand Down

0 comments on commit 2f70888

Please sign in to comment.