def playoff_info(season): data = nhl_api.data.get_playoff_data(season) parsed = data.json() season = parsed["season"] output = {'season': season} try: playoff_rounds = parsed["rounds"] rounds = {} for r in range(len(playoff_rounds)): rounds[str(playoff_rounds[r]["number"])] = MultiLevelObject( playoff_rounds[r]) output['rounds'] = rounds except KeyError: debug.error("No data for {} Playoff".format(season)) output['rounds'] = False try: default_round = parsed["defaultRound"] output['default_round'] = default_round except KeyError: debug.error("No default round for {} Playoff.".format(season)) default_round = 0 output['default_round'] = default_round return output
def player_info(playerId): data = nhl_api.data.get_player(playerId) parsed = data.json() player = parsed["people"][0] return MultiLevelObject(player)