def update_heroes(): """Update the list of heroes and download the images.""" heroes = api.get_heroes() dict_to_json_file(heroes, os.path.join(JSON_DIR, "heroes.json")) for hero in heroes["result"]["heroes"]: download_hero_image(hero["name"][14:], "sb", os.path.join(HERO_IMG_DIR, str(hero["id"])+"_sb.png")) download_hero_image(hero["name"][14:], "lg", os.path.join(HERO_IMG_DIR, str(hero["id"])+"_lg.png"))
def update_items(): """Update the list of items and download the images.""" items = api.get_game_items() dict_to_json_file(items, os.path.join(JSON_DIR, "items.json")) for item in items["result"]["items"]: download_item_image(item["name"][5:], os.path.join(ITEM_IMG_DIR, str(item["id"])+"_lg.png"))