Created
May 29, 2017 01:28
-
-
Save MC42/bb0a724ca9ba80befe335918e1ff1ba1 to your computer and use it in GitHub Desktop.
Revisions
-
MC42 created this gist
May 29, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ 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)