6d9864f6e0
's code
14 lines
305 B
Python
Executable file
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')) |