Created
October 20, 2016 19:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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