
import json
import urllib.request
import turtle

import time

url = 'http://api.open-notify.org/astros.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())

print(result)

print("People on the ISS: ",result['number'])
people = result['people']
#print(people)

#for person in people:
#    print(person)

for person in people :
    print(person['name'])


url = 'http://api.open-notify.org/iss-now.json'
response = urllib.request.urlopen(url)
result = json.loads(response.read())

print(result)

location = result['iss_position']
latitude = location['latitude']
longitude = location['longitude']

print('Latitude:  ',latitude)
print('Longitude: ',longitude)

screen = turtle.Screen()

screen.setup(720,360)
screen.setworldcoordinates(-180,-90,180,90)
screen.bgpic('map.gif')


screen.register_shape('iss.gif')
iss = turtle.Turtle()
iss.shape('iss.gif')
iss.setheading(90)

iss.penup()
iss.goto(float(longitude),float(latitude) )

# Print the map

time.sleep(10)
