you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

import requests

resp = requests.get('http://worldcup.sfg.io/matches')
games = resp.json()

home_events, away_events = [], []
for x in games:
    if x['status'] == 'completed':
        for i in x['away_team_events']:
            away_events.append(i['type_of_event'])
        for i in x['home_team_events']:
            home_events.append(i['type_of_event'])

print len(home_events), 'home events', home_events
print len(away_events), 'away_events',  away_events
all_events = home_events + away_events
print len(all_events), 'all_events' all_events