Scripting Language: Python 3.6
Reference Book: Python Data Visualization Cookbook [Milovanović 2013-11-25]
Teaching myself Python Data Visualization
When I execute code from book
import requests
url = 'https://github.com/timeline.json'
r = requests.get(url)
json_obj = r.json()
repos = set() # we want just unique urls
for entry in json_obj:
try:
repos.add(entry['repository']['url'])
except KeyError as e:
print ("No key %s. Skipping..." % (e))
from pprint import pprint
pprint(repos)
I get error
repos.add(entry['repository']['url'])
TypeError: string indices must be integers
How to troubleshoot? When I see similar threads, I draw a blank
Is the code from book even correct?
[As an aside, where did set() in repos = set()
come from?]
Please point me in the right direction