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 data['people']:
print(f' {person["name"]} aboard {person["craft"]}')
if __name__ == '__main__':
iss_position()
people_in_space()
Output
ISS Position: 45.2341, -122.8673
As of: 14:32:07 UTC
6 humans in space right now:
Oleg Kononenko aboard ISS
Tracy Dyson aboard ISS
Matthew Dominick aboard ISS
Why This Is a Perfect First API Project
- No auth - skip the OAuth tutorial, just fetch data
- Real-time - the position changes every second
- Human element - actual names of real people in space
- Visual potential - plot on a map for an impressive portfolio project
- Conversation starter - show anyone and they will ask questions
Build Ideas
- Is the ISS above me? Compare ISS position to user geolocation
- Orbit visualizer - poll every 10 seconds, plot the path
- Slack bot - /iss command that shows position and crew
- Raspberry Pi display - dedicated screen showing ISS position 24/7
I have built Python clients for 25+ free APIs including ISS, SpaceX, earthquakes, weather, and crypto.
What would you build with real-time ISS data?
Top comments (0)