go-challenge/jagestah/app.py

14 lines
305 B
Python
Raw Normal View History

2018-10-04 10:51:10 -05:00
#!/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'))