So in the excercise Program Name and NPR URL


#1

I managed to fix my indentation problem with a text editor, but now it only says Oops try again and everything seems to print correctly

indent preformatted text by 4 spaces
from urllib2 import urlopen
from json import load, dumps

url = 'http://api.npr.org/query?apiKey=' 
key = 'API_KEY'
url = url + key
url += '&numResults=1&format=json&id=1007&requiredassets=image,audio,text' #1007 is science

response = urlopen(url)
json_obj = load(response)

# uncomment 3 lines below to see JSON output to file
f = open('output.json', 'w')
f.write(dumps(json_obj, indent=4))
f.close()

for story in json_obj['list']['story']:
    print "TITLE: " + story['title']['$text'] + "\n"
    print "DATE: " + story['storyDate']['$text'] +"\n"
    print "TEASER: "+ story['teaser']['$text']+'\n'

    if ('byline' in story):
        h="BYLINE: "+story['byline'][0]['name']['$text']
        print(h+"\n")

    if ("show" in story):
        g="PROGRAM: "+story['show'][0]['program']['$text']
        print(g+"\n")
    print("NPR URL: "+(story['link'][0]['$text'])+("\n"))

#2

I'm not sure if this is the problem but on line 8 you have written 'requiredassets' instead of using "camelCase" i.e. 'requiredAssets'.