Skip to content

Instantly share code, notes, and snippets.

@MC42
Created May 29, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MC42/bb0a724ca9ba80befe335918e1ff1ba1 to your computer and use it in GitHub Desktop.
Save MC42/bb0a724ca9ba80befe335918e1ff1ba1 to your computer and use it in GitHub Desktop.
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