Real-Time Asteroid Watch

asteroidEvery day asteroids are passing close to planet Earth. Their trajectory is closely monitored by NASA as some of these could potentially pose a threat to our planet. In this python challenge we are going to use the NeoWs API to retrieve some real-time data from NASA about these near Earth asteroids.

You can read more about the NeoWs API on: https://api.nasa.gov/api.html#neows-feed

JSON Data


This API uses JSON to format the data. JSON (JavaScript Object Notation) is a popular lightweight data-interchange format. Its main benefit is that it is easy for humans to read and write and it is easy for machines to parse and generate as you can see in the code provided below. You can read more about JSON on https://www.json.org/

You can see what the JSON data returned by the API looks like:
https://api.nasa.gov/neo/rest/v1/feed?start_date=2015-09-07&end_date=2015-09-08&api_key=DEMO_KEY

Python Code


Check our code to see how we make a call to the API and how we retrieve and extract the requested JSON data.

Your Task


Update this code to show all the near Earth asteroids approaching Earth in the next 7 days.
The JSON data also contains links to web pages for each asteroid (e.g. https://ssd.jpl.nasa.gov/sbdb.cgi?sstr=3745034). Update the Python code to also display the relevant web addresses.

Did you like this challenge?

Click on a star to rate it!

Average rating 4.2 / 5. Vote count: 15

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: