tra-analysis/data analysis/tba.py

11 lines
505 B
Python
Raw Normal View History

2020-02-20 03:50:56 +00:00
import requests
def req_event_matches(eventkey,apikey):
headers={'X-TBA-Auth-Key':apikey}
r=requests.get('https://www.thebluealliance.com/api/v3/event/'+eventkey+'/matches/simple', headers=headers)
return r
2020-02-21 01:22:06 +00:00
def get_match_data(request):
2020-02-21 01:19:20 +00:00
if request.status_code == 200:
2020-02-20 03:50:56 +00:00
x=[]
for i in sorted(request.json(), key=lambda i: i['actual_time']):
x.append([[i['alliances']['red']['team_keys'], i['alliances']['blue']['team_keys']],i['winning_alliance']])
2020-02-21 01:27:09 +00:00
return x