download data: log failed game_json

This commit is contained in:
Maximilian Keßler 2023-06-25 10:07:11 +02:00
parent 7845c79889
commit 1d266d7e35
Signed by: max
GPG key ID: BCC5A619923C0BA5
2 changed files with 3 additions and 3 deletions

View file

@ -31,7 +31,7 @@ def detailed_export_game(game_id: int, score: Optional[int] = None, var_id: Opti
assert_msg = "Invalid response format from hanab.live while exporting game id {}".format(game_id)
game_json = get("export/{}".format(game_id))
assert game_json.get('id') == game_id, assert_msg
assert game_json.get('id') == game_id, assert_msg + ": " + str(game_json)
players = game_json.get('players', [])
num_players = len(players)

View file

@ -1,5 +1,5 @@
import json
import requests
from typing import Optional, Dict
import requests_cache
from log_setup import logger
@ -8,7 +8,7 @@ from log_setup import logger
session = requests_cache.CachedSession('hanab.live')
def get(url, refresh=False):
def get(url, refresh=False) -> Optional[Dict]:
# print("sending request for " + url)
query = "https://hanab.live/" + url
logger.debug("GET {} (force_refresh={})".format(query, refresh))