Mission 52-8: Working with APIs: answer working in dq console but not in jupyter notebook

Screen Link:

My Code: # Make the same request we did two screens ago.
parameters = {“lat”: 37.78, “lon”: -122.41}
response = requests.get(“http://api.open-notify.org/iss-pass.json”, params=parameters)

Get the response data as a Python object. Verify that it’s a dictionary.

json_data = response.json()
print(type(json_data))
print(json_data)
first_pass_duration = json_data[“response”][0][“duration”]

# Make the same request we did two screens ago.
parameters = {"lat": 37.78, "lon": -122.41}
response = requests.get("http://api.open-notify.org/iss-pass.json", params=parameters)

# Get the response data as a Python object.  Verify that it's a dictionary.
json_data = response.json()
print(type(json_data))
print(json_data)
first_pass_duration = json_data["response"][0]["duration"]

What I expected to happen:

What actually happened:

Replace this line with the output/error
1 Like

The official site for the API mentions the following:

Depreciation

ISS Pass predictions are now turned off. Real time current ISS location and number of people in space will continue to operate.

Also this:

International Space Station Pass Times

This api has been removed.

My hunch is in the dataquest console, the get request is intercepted and what you get instead is data from dataquest’s own server.

Try changing the parameter values and you’ll see that everything except the initial value will return Not Found. The prediction api should return a value calculated from a combination of latitude and longitude, but it’s weird that even changing the value by 0.1 will also return Not Found.

Though, an official answer would be better than my theory.

Thank you for the answer;

I did suspect as much but there is still no official answer from DQ;

1 Like

HI @saleemdar.dr,

I’m not sure that I understood your issue, but I hope that our Technical Support team will be able to help you. Could you please send them your request following the steps described in this post? Just select your case and follow the instructions. Thank you!

Thank you for the reply;
I will try and follow your advice;

1 Like