import random import requests def get_dog(): return random.choice([random_sheeb, random_dog])() def random_sheeb(): return requests.get( 'http://shibe.online/api/shibes?count=1&urls=true' ).text.split('"')[1] def random_dog(): return "https://random.dog/{}".format( requests.get('https://random.dog/woof').text )