I'm trying to learn API's and I have a call to http://api.zippopotam.us/us/90210 which yields:
{"post code": "90210", "country": "United States", "country abbreviation": "US", "places": [{"place name": "Beverly Hills", "longitude": "-118.4065", "state": "California", "state abbreviation": "CA", "latitude": "34.0901"}]}
The API uses country (US) and zip code to return the "place". I tried to parse the "place" segment to a variable like so:
for item in api_return:
place = item['place']
However, I get an error message saying "TypeError: String indices must be integers"`. Is there another way to parse this long list to extract the "place name", "state" etc.?
Thanks in advance!