fixing not able to display multiple sport leagues

This commit is contained in:
Justin 2022-03-04 23:05:45 +08:00 committed by GitHub
parent e85d0113a1
commit 6b85ca6083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,32 +463,32 @@ def updateLeagueEvents(api_key, time):
print(all_data)
events = []
#events = []
for league in all_data.keys():
for d in all_data[league]:
event = {}
event['date'] = d['dateEvent']
#for league in all_data.keys():
#for d in all_data[league]:
#event = {}
#event['date'] = d['dateEvent']
if time == 'live':
#if time == 'live':
event['progess'] = d['strProgress']
event['status'] = d['strStatus']
else:
#event['progess'] = d['strProgress']
#event['status'] = d['strStatus']
#else:
event['round'] = d['intRound']
event['time'] = d['strTime']
event['home_team'] = d['strHomeTeam']
#event['round'] = d['intRound']
#event['time'] = d['strTime']
#event['home_team'] = d['strHomeTeam']
event['away_team'] = d['strAwayTeam']
#event['away_team'] = d['strAwayTeam']
if time != 'upcoming':
event['away_score'] = d['intAwayScore']
event['home_score'] = d['intHomeScore']
#if time != 'upcoming':
#event['away_score'] = d['intAwayScore']
#event['home_score'] = d['intHomeScore']
events.append(event)
leagues_info[league.upper()] = events
all_settings['leagues'] = leagues_info
#events.append(event)
#leagues_info[league.upper()] = events
all_settings['leagues'] = all_data
json.dump(all_settings, open( "csv/{}_games.json".format(time), 'w+' ))
except Exception as e: