async def get_blob(ctx: HTTPRequestContext, battletag: str): """ Returns a giant blob of data. """ pages = await fetch_all_user_pages(ctx, battletag, platform=ctx.request.args.get("platform", "pc")) built_dict = {} for region, result in pages.items(): if result is None: built_dict[region] = None continue d = { "heroes": {"playtime": {"competitive": {}, "quickplay": {}}, "stats": {"competitive": {}, "quickplay": {}}}, "stats": {}, "achievements": {} } d["stats"]["quickplay"] = parsing.bl_parse_stats(result) d["stats"]["competitive"] = parsing.bl_parse_stats(result, mode="competitive") d["heroes"]["stats"]["quickplay"] = parsing.bl_parse_hero_data(result) d["heroes"]["playtime"]["quickplay"] = parsing.bl_parse_all_heroes(result) d["heroes"]["stats"]["competitive"] = parsing.bl_parse_hero_data(result, mode="competitive") d["heroes"]["playtime"]["competitive"] = parsing.bl_parse_all_heroes(result, mode="competitive") d["achievements"] = parsing.bl_parse_achievement_data(result) built_dict[region] = d return built_dict
async def get_achievements(ctx: HTTPRequestContext, battletag: str): """ Fetches hero stats, for competitive. """ pages = await fetch_all_user_pages(ctx, battletag, platform=ctx.request.args.get( "platform", "pc")) built_dict = {} for region, result in pages.items(): if result is None: built_dict[region] = None continue status = result.xpath( ".//p[@class='masthead-permission-level-text']")[0].text if "private" in status.lower(): return {"error": "Private"}, 403 d = {"achievements": parsing.bl_parse_achievement_data(result)} built_dict[region] = d return built_dict
async def get_blob(ctx: HTTPRequestContext, battletag: str): """ Returns a giant blob of data. """ pages = await fetch_all_user_pages(ctx, battletag, platform=ctx.request.args.get("platform", "pc")) built_dict = {} for region, result in pages.items(): if result is None: built_dict[region] = None continue d = { "heroes": {"playtime": {"competitive": {}, "quickplay": {}}, "stats": {"competitive": {}, "quickplay": {}}}, "stats": {}, "achievements": {}} d["stats"]["quickplay"] = parsing.bl_parse_stats(result) d["stats"]["competitive"] = parsing.bl_parse_stats(result, mode="competitive") d["heroes"]["stats"]["quickplay"] = parsing.bl_parse_hero_data(result) d["heroes"]["playtime"]["quickplay"] = parsing.bl_parse_all_heroes(result) d["heroes"]["stats"]["competitive"] = parsing.bl_parse_hero_data(result, mode="competitive") d["heroes"]["playtime"]["competitive"] = parsing.bl_parse_all_heroes(result, mode="competitive") d["achievements"] = parsing.bl_parse_achievement_data(result) built_dict[region] = d return built_dict
async def get_blob(ctx: HTTPRequestContext, battletag: str): """ Returns a giant blob of data. """ pages = await fetch_all_user_pages(ctx, battletag, platform=ctx.request.args.get( "platform", "pc")) built_dict = {} for region, result in pages.items(): if result is None: built_dict[region] = None continue status = result.xpath( ".//p[@class='masthead-permission-level-text']")[0].text if "private" in status.lower(): return {"error": "Private"}, 403 d = { "heroes": { "playtime": { "competitive": {}, "quickplay": {} }, "stats": { "competitive": {}, "quickplay": {} } }, "stats": {}, "achievements": {} } d["stats"]["quickplay"] = parsing.bl_parse_stats(result, status=status) d["stats"]["competitive"] = parsing.bl_parse_stats(result, mode="competitive", status=status) d["heroes"]["stats"]["quickplay"] = parsing.bl_parse_hero_data(result) d["heroes"]["playtime"]["quickplay"] = parsing.bl_parse_all_heroes( result) d["heroes"]["stats"]["competitive"] = parsing.bl_parse_hero_data( result, mode="competitive") d["heroes"]["playtime"]["competitive"] = parsing.bl_parse_all_heroes( result, mode="competitive") d["achievements"] = parsing.bl_parse_achievement_data(result) built_dict[region] = d return built_dict
async def get_achievements(ctx: HTTPRequestContext, battletag: str): """ Fetches hero stats, for competitive. """ pages = await fetch_all_user_pages(ctx, battletag, platform=ctx.request.args.get("platform", "pc")) built_dict = {} for region, result in pages.items(): if result is None: built_dict[region] = None continue d = {"achievements": parsing.bl_parse_achievement_data(result)} built_dict[region] = d return built_dict