Created
May 29, 2017 01:28
-
-
Save MC42/bb0a724ca9ba80befe335918e1ff1ba1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import requests | |
from tqdm import tqdm | |
baseURL = 'http://www.thebluealliance.com/api/v2/' | |
header = {'X-TBA-App-Id': 'tjf:thepythonalliance:award_math'} | |
most = ["",0] | |
rows = [] | |
with open('teams.csv', 'r') as csvfile: | |
spamreader = csv.reader(csvfile, delimiter=',') | |
for row in spamreader: | |
rows.append(row) | |
for row in tqdm(rows): | |
if (len(row)) > 0: | |
myRequest = (baseURL + 'team/' + row[0] + "/history/awards") | |
response = requests.get(myRequest, headers=header) | |
jsonified = response.json() | |
total = 0 | |
for award in jsonified: | |
if award['award_type'] == 22: | |
total+=1 | |
if total > most[1]: | |
most[0] = row[0] | |
most[1] = total | |
print(most) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment