I'm trying to use python to pull data from thebluealliance.com. This is my first attempt at doing this, and I was successful at getting some data from the site, however its not how I need it. Requests.json() is returning a list for me when I need a dictionary in order to parse based on keys. How would I go about converting it to a dictionary? I currently get an error saying that the indices need to be integers, not strings.
Heres the code im using to get the data.
response = requests.get(TBA_URL + '/event/2019pncmp/teams/simple?X-TBA-Auth-Key=' + TBA_AUTH_KEY)
data = response.json()
print(data['city']) //Error is here.
Example data
:
[{'city': 'Issaquah', 'country': 'USA', 'key': 'frc1318',
'name': 'The Boeing Company/State of Washington OSPI/Issaquah Schools Foundation&Issaquah High School',
'nickname': 'Issaquah Robotics Society', 'state_prov': 'Washington',
'team_number': 1318}, {'city': 'Wilsonville', 'country': 'USA',
'key': 'frc1425', 'name': 'Lam Research/3D Systems/Xerox/DW Fritz/Rockwell Collins/TE Connectivity/Mentor Graphics/A-dec/City Of Wilsonville/Shields Manufacturing/Oregon Technology/Apex Plastics&Wilsonville High School',
'nickname': 'Error Code Xero', 'state_prov': 'Oregon', 'team_number': 1425},
...]