Skip to content

Instantly share code, notes, and snippets.

@4Kaylum
Last active May 3, 2018 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4Kaylum/1b49e030545f6d8aaa9cd4e306003fd8 to your computer and use it in GitHub Desktop.
Save 4Kaylum/1b49e030545f6d8aaa9cd4e306003fd8 to your computer and use it in GitHub Desktop.
from requests import get
def get_dog(*, dog_id:str='', limit:int=1) -> dict:
url = 'https://api.thedogapi.co.uk/v2/dog.php'
params = {}
if dog_id:
params.update({'id': dog_id})
if limit > 1:
params.update({'limit': limit})
site = get(url, params=params)
return site.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment