fixing not able to display multiple sport leagues
This commit is contained in:
parent
e85d0113a1
commit
6b85ca6083
@ -463,32 +463,32 @@ def updateLeagueEvents(api_key, time):
|
|||||||
|
|
||||||
print(all_data)
|
print(all_data)
|
||||||
|
|
||||||
events = []
|
#events = []
|
||||||
|
|
||||||
for league in all_data.keys():
|
#for league in all_data.keys():
|
||||||
for d in all_data[league]:
|
#for d in all_data[league]:
|
||||||
event = {}
|
#event = {}
|
||||||
event['date'] = d['dateEvent']
|
#event['date'] = d['dateEvent']
|
||||||
|
|
||||||
if time == 'live':
|
#if time == 'live':
|
||||||
|
|
||||||
event['progess'] = d['strProgress']
|
#event['progess'] = d['strProgress']
|
||||||
event['status'] = d['strStatus']
|
#event['status'] = d['strStatus']
|
||||||
else:
|
#else:
|
||||||
|
|
||||||
event['round'] = d['intRound']
|
#event['round'] = d['intRound']
|
||||||
event['time'] = d['strTime']
|
#event['time'] = d['strTime']
|
||||||
event['home_team'] = d['strHomeTeam']
|
#event['home_team'] = d['strHomeTeam']
|
||||||
|
|
||||||
event['away_team'] = d['strAwayTeam']
|
#event['away_team'] = d['strAwayTeam']
|
||||||
|
|
||||||
if time != 'upcoming':
|
#if time != 'upcoming':
|
||||||
event['away_score'] = d['intAwayScore']
|
#event['away_score'] = d['intAwayScore']
|
||||||
event['home_score'] = d['intHomeScore']
|
#event['home_score'] = d['intHomeScore']
|
||||||
|
|
||||||
events.append(event)
|
#events.append(event)
|
||||||
leagues_info[league.upper()] = events
|
#leagues_info[league.upper()] = events
|
||||||
all_settings['leagues'] = leagues_info
|
all_settings['leagues'] = all_data
|
||||||
|
|
||||||
json.dump(all_settings, open( "csv/{}_games.json".format(time), 'w+' ))
|
json.dump(all_settings, open( "csv/{}_games.json".format(time), 'w+' ))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user