This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by gryff
about 11 years

"Did you create a query string parameter for format ?"

I don’t understand what is wrong for 1.4, I’ve done everything it says and compared my code against the code for 1.1 and can’t see any difference at all. Am I missing something?

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 tried separating the concat like so:

url+='&numResults=3'
url+='&format=json'

I also tried clearing cache.

I am out of ideas :(

Answer 5135ded507bbf032400035e8

6 votes

Permalink

I bet you have found your mistake by now - if you still care, you used “url += url +key” which doubled your URL string.

points
Submitted by Tim Parbs
about 11 years

1 comments

gryff about 11 years

I hadn’t, I was busy learning Django and forgot about this track, thanks for your answer!

Answer 513350e7dd51efe03b005f60

1 vote

Permalink

For me this worked perfectly:

from urllib2 import urlopen
from json import load

url = "http://api.npr.org/query?apiKey="
key = "API_KEY"
url += key
url += "&numResults=3&format=json"
points
Submitted by Antonio Petrov
about 11 years

1 comments

Aezakmi over 10 years

I have the same code but it doesn’t work…

Answer 52c6eee5548c35d4ca00320c

0 votes

Permalink

i control time and space

points
Submitted by JoeHaaga
about 10 years