Back to articles
NASA API: Get Satellite Images and Mars Rover Photos (Free, No Credit Card)

NASA API: Get Satellite Images and Mars Rover Photos (Free, No Credit Card)

via Dev.to BeginnersAlex Spinov

NASA's API gives you access to satellite imagery, Mars rover photos, asteroid tracking, and astronomy picture of the day. Completely free. No credit card. 1,000 requests/hour. Get Your API Key (30 Seconds) Go to api.nasa.gov → enter email → instant API key. Or use DEMO_KEY for testing (30 req/hr). 1. Astronomy Picture of the Day import httpx API_KEY = ' your_key_or_DEMO_KEY ' def apod ( date = None ): params = { ' api_key ' : API_KEY } if date : params [ ' date ' ] = date # YYYY-MM-DD r = httpx . get ( ' https://api.nasa.gov/planetary/apod ' , params = params ) data = r . json () return { ' title ' : data [ ' title ' ], ' explanation ' : data [ ' explanation ' ][: 200 ], ' url ' : data [ ' url ' ], ' media_type ' : data [ ' media_type ' ] } today = apod () print ( f " { today [ ' title ' ] } \n { today [ ' url ' ] } " ) 2. Mars Rover Photos def mars_photos ( rover = ' curiosity ' , sol = 1000 , camera = ' NAVCAM ' ): """ Get photos from Mars rovers. Rovers: curiosity, opportunity, spir

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
7 views

Related Articles