Skip to content

Instantly share code, notes, and snippets.

@r3dact3d
Created October 20, 2016 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r3dact3d/91fa5a0016b626123fcbf21e5f7dbf60 to your computer and use it in GitHub Desktop.
Save r3dact3d/91fa5a0016b626123fcbf21e5f7dbf60 to your computer and use it in GitHub Desktop.
Will provide current number of humans in space and names along with the space craft.
#!/usr/bin/env python
# [r3dact3d]
import requests
url = 'http://api.open-notify.org/astros.json'
j = requests.get(url).json()
number = j['number']
people = j['people']
print "=================================="
print "Humans in space currently: %s" % number
for i in range(0, number):
boat = j['people'][i]['craft']
name = j['people'][i]['name']
print "Craft: %s Name: %s" % (boat, name)
print "---------------------------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment