
I Built an ISS Tracker That Shows Astronauts in Space Right Now (30 Lines of Python)
I wanted to show my students something cool about APIs. Something visual, real-time, and mind-blowing. So I built a script that tells you exactly where the International Space Station is right now and who is aboard it. 30 lines. No API key. Updates every second. The API Open Notify is a free API that tracks the ISS position and crew. Three endpoints, zero authentication. The Code import requests from datetime import datetime , timezone def iss_position (): r = requests . get ( ' http://api.open-notify.org/iss-now.json ' ) data = r . json () pos = data [ ' iss_position ' ] print ( f ' ISS Position: { pos [ " latitude " ] } , { pos [ " longitude " ] } ' ) ts = datetime . fromtimestamp ( data [ ' timestamp ' ], tz = timezone . utc ) print ( f ' As of: { ts . strftime ( " %H : % M : % S UTC " ) } ' ) def people_in_space (): r = requests . get ( ' http://api.open-notify.org/astros.json ' ) data = r . json () print ( f ' { data [ " number " ] } humans in space right now: ' ) for person in da
Continue reading on Dev.to Beginners
Opens in a new tab



