Compare commits

...

1 commit

Author SHA1 Message Date
1d266d7e35
download data: log failed game_json 2023-06-25 10:07:11 +02:00
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) assert_msg = "Invalid response format from hanab.live while exporting game id {}".format(game_id)
game_json = get("export/{}".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', []) players = game_json.get('players', [])
num_players = len(players) num_players = len(players)

View file

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