diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index 4f3dac6..cf3acb9 100644 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -335,7 +335,7 @@ class BattleRecordCategory(): def get_headers(self): try: headers = [ RESULT_CAT_HEADER_FRMT.format(result_categories[self.category_name][0]) ] - for field in result_fields.keys(): + for field in result_display_fields: print_format = '{:^' + str(result_fields[field][2]) + 's}' headers.append(print_format.format(result_fields[field][0])) return headers diff --git a/blitzutils.py b/blitzutils.py index 8a613ff..7484456 100644 --- a/blitzutils.py +++ b/blitzutils.py @@ -252,13 +252,15 @@ async def open_JSON(filename: str, chk_JSON_func = None) -> dict: return None -async def get_url_JSON(session: aiohttp.ClientSession, url, chk_JSON_func = None, max_tries = MAX_RETRIES) -> dict: +async def get_url_JSON(session: aiohttp.ClientSession, url: str, chk_JSON_func = None, max_tries = MAX_RETRIES) -> dict: """Retrieve (GET) an URL and return JSON object""" if session == None: error('Session must be initialized first') sys.exit(1) - - ## To avoid excessive use of servers + if url == None: + return None + + ## To avoid excessive use of servers for retry in range(1,max_tries+1): try: await asyncio.sleep(SLEEP) @@ -830,10 +832,7 @@ class WG: async def get_player_tank_stats(self, account_id: int, tank_ids = [], fields = [], cache=True) -> dict: """Get player's stats (WR, # of battles) in a tank or all tanks (empty tank_ids[])""" - # debug('Started') - try: - #debug('account_id: ' + str(account_id) + ' TankID: ' + ','.join([ str(id) for id in tank_ids])) stats = None # try cached stats first: