go-challenge/jagestah/app.py
jagestah 6d9864f6e0 Adding Jagestah
's code
2018-10-04 09:51:10 -06:00

14 lines
305 B
Python
Executable file

#!/usr/bin/env python
import swapi
import requests
ships = (swapi.get_all("starships"))
print (ships)
for ship in ships.iter():
if len(ship.pilots) > 0:
print(ship.name)
for pilot in ship.pilots:
response = requests.get(pilot)
data = response.json()
print(" "+data["name"].encode('utf-8'))