Skip to content
This library wraps dog.ceo's DogAPI
Branch: master
Clone or download
Latest commit ea610bc Jul 21, 2017

README.md

Python DogAPI

This library wraps dog.ceo's DogAPI

Functions

  1. list()
    • Returns an array of all the dog images from all the breeds
  2. 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.
  3. 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.

Usage

  1. Create a dogapi object: dogapi = DogAPI()
  2. Call a function:
    1. dogapi.list()
    2. dogapi.list_images()
    3. dogapi.list_images("cairn")
    4. dogapi.random()
    5. dogapi.random("boxer")

Simple Example Program

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())
You can’t perform that action at this time.