NASA API being blocked?

This seems like the type of problem where there’s a good chance I’m missing something too obvious to notice, so I apologize in advance if that’s the case.

I want to use NASA APIs in observable as I figure this would be a good platform for some demos of what can be done with the data. “api dot nasa dot gov” … trying to make it look like not a link so I can still post it without exceeding new user link threshold.

This worked initially and by initially I mean for multiple notebooks over several hours and in other people’s notebooks I forked that use a api dot nasa dot gov API.

For example:
This one: https://beta.observablehq.com/@justingosses/nasa-api-explorer
And this one: https://beta.observablehq.com/@nclarkcoder/request-playground

However, what I now experience is all my API calls fail. This is confusing because when I put the exact same API call string into my browser, it works fine. Additionally, when I wait several days to try it again via Observable (assuming it might be related to exceeding some threshold), I get the same behavior of the API call failing.

Are certain APIs being blocked on the observable side or the API dot NASA dot Gov side? Does the API call appear to come from ObservableHQ IP and not my own? Am I missing something obvious?

Thanks in advance.

Justin

The requests are made from your own computer and IP; Observable just hosts the code without running it on their own servers (except for the thumbnail generator I guess). I’m not sure what the precise issue is (the API calls in the two notebooks you linked work fine for me), so you may want to open up your browser’s dev tools and examine the network requests to see what, if any, errors are being returned.

Adding to what @bgchen already wrote, you’ll want to inspect the response headers, as they’ll likely give you the reason why you’re being blocked (e.g. running into a rate limit).

Edit: I just noticed that you already dump the headers in your notebook. Are you certain that the key you’re testing with is only used by you?

Thanks for the responses. I figure it out. API.nasa.gov was being blocked by EFF’s privacy badger browser add-on. https://www.eff.org/privacybadger

but it only blocks it when called from within an observableHQ notebook. When I put that API URL in the browser bar, it downloads data fine and nothing gets flagged as worthy of being blocked? Anyone know anything about browser add-ons know why that might be the case?

Likely because in your notebook it’s a cross origin request, not a URL you access directly. I only skimmed through this article but it seems to mention the symptoms you’re seeing.

1 Like

Thanks @moortari . That’s helpful. I also submitted an issue on privacy badger’s page as it seems they’ve whitelisted similar situations before. blocks api.nasa.gov and apod.nasa.gov when those APIs called from ObservableHQ · Issue #2251 · EFForg/privacybadger · GitHub