Hello. I’m currently a senior with team 2823. I’ve been trying to use The Blue Alliance to gather statistical data for a school project. My programs had been working, up until today.
Here is the python code I’ve been working with:
import urllib2 import json manyevents="mnmi","mnmi2","mndu2","mndu"] for i in range(2013,2016): for j in manyevents: try: question="http://www.thebluealliance.com/api/v2/event/"+str(i)+j+"/stats" req=urllib2.Request(question) req.add_header('X-TBA-App-Id', 'd-wheezy:matchgrabber:2') response=urllib2.urlopen(req) hi=response.read() print hi except urllib2.HTTPError: print "event "+str(i)+j+" doesn't exist "
The goal was to have it simply print out the result of the API call. It gave me back 403:Forbidden.
I checked my API calls against the example ones on The Blue Alliance. They seemed correct.
Still worried that it was my code, I ran this code
At this point, I have no idea what is wrong. If you see something, let me know. I do have a theory, but I don’t think that it is realistic.
I did some googling to find out if it was possible that my IP was blocked or something. Instead, I stumbled across a thread on the dev group about upgrading to https. It is dated for September 7th, which would explain why my code stopped working suddenly. I don’t know much about API calls, but it seems like redirecting them to https could cause problems.
To help test this, I decided to check a scouting app that explicitly used The Blue Alliance API. FRC Krawler explicitly stated that it used the Blue Alliance API here. I downloaded it, and tested it. The app ran fine, but no events were able to be selected for any year (PS: If anybody from Knight Krawler is reading this, your app does not handle a blank event field very well).
I also tested two more popular FRC apps, FRC Spyder, and The Blue Alliance app. Both worked fine.
I’m assuming there is a bug in my code, but I can’t find it.