This library wraps dog.ceo's DogAPI
list()
- Returns an array of all the dog images from all the breeds
list_images(breed[, subbreed])
- Returns an array of all the images from the breed,
- if you also provide a subbredd (in addition to the breed) the list will only include images from that subbreed.
random([breed][, subbreed])
- Returns a random dog image from all the breeds if no parameters are passed.
- If a breed is provided it will return an array of all the images from the breed,
- and if you pass a subbreed (as well as a breed) it will return an array of all the images from the subbreed.
- Create a dogapi object:
dogapi = DogAPI()
- Call a function:
dogapi.list()
dogapi.list_images()
dogapi.list_images("cairn")
dogapi.random()
dogapi.random("boxer")
from pprint import pprint
from random import choice
import DogAPI
dogapi = DogAPI()
breeds = dogapi.list()['message']
pprint(dogapi.random(choice(breeds)))
pprint(dogapi.list_images(choice(breeds)))
pprint(dogapi.random())