4. Specifying Results and Output Format


#1

I'm working my way throug the API and am getting what seems like an odd error with this code

from urllib2 import urlopen
from json import load 

url = "http://api.npr.org/query?apikey="
key = "API_KEY"
url += url + key 
url += "&numResults=3&format=json"

I get:

Oops, try again.
Did you create a query string parameter for format ?


#2

Try changing this line

url += url + key

to this:

url += key

#3

Thanks, will try this later and keep you posted. It's better to make these mistakes now than on my Pi

Lee Schneider <codecademy@discoursemail.com> wrote:

>

>

>

>Try changing this line

>`

>url += url + key

>`

>

>to this:

>`

>url += key

>`

>

>

>

>

>

>

>---

>Visit Topic or reply to this email to respond.

>

>To unsubscribe from these emails, click here.

#006699;; font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;color:#3b5998;text-decoration:none;font-weight:bold">designcoder87342

August 14

Try changing this line

url += url + key

to this:

url += key


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.



#4

This is creating an incorrect url and looks like incorrect python as well.