download data: log failed game_json
This commit is contained in:
parent
7845c79889
commit
1d266d7e35
2 changed files with 3 additions and 3 deletions
|
@ -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)
|
||||||
|
|
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue