Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Created May 11, 2017 20:54
Show Gist options
  • Save fmasanori/7beb9dd4829844177cda5d529ab4c687 to your computer and use it in GitHub Desktop.
Save fmasanori/7beb9dd4829844177cda5d529ab4c687 to your computer and use it in GitHub Desktop.
Species from Star Wars movies
import requests
import json
url = 'http://swapi.co/api/species/'
for d in range(1, 5):
d = '' if d == 1 else '?page='+str(d)
res = requests.get(url+str(d))
res = json.loads(res.content.decode('utf-8'))
for specie in res['results']:
print (specie['name'], specie['classification'],
specie['language'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment