25. Get Our Transcript on JSON


#1

Not sure what is wrong with my code. It seems like simple instruction which is very similar to code already seen on lines 8 and 9 in 23. Intro To Transcripts. Here's my code:

from urllib2 import urlopen
from json import load

key = "API_KEY"
url = "http://api.npr.org/transcript"
url += '?apiKey=key'
url += '&format=json'
url += '&id=152248901'

response = urlopen(url)
j = load(response)

The error I'm getting is: Your value of j is incorrect. Make sure you called the urlopen and load correctly.


#2

@astrophe717,
could you provide the link to the exercise....


#3

On Codecademy's homepage, scroll to the bottom and just above the footer it says 'Learn APIs'. If you click the link it takes you to a number of courses about APIs, some of which use Python. I am going through the course 'Learn to use the NPR API'. You can unlock successive lessons by completing the previous ones. I'm stuck on 25 Get Our Transcript on JSON.


#4

@astrophe717,
From
http://www.npr.org/api/inputReference.php
Access Parameters

NAME DESCRIPTION

apiKey

The apiKey parameter is required for all API requests.
To get a key, you must register.
Once registered, you can get and/or change your apiKey from your Account Manager.
Upon registration, your apiKey will be saved to a cookie that will enable the Query Generator to apply your apiKey to your queries..

And the link i was asking for was
https://www.codecademy.com/en/courses/python-intermediate-en-NwwHi/3/3