Dog Pics and Videos is a fun API that will show you random links of cute dog pictures and videos. They have a really fun selection of media. With the help of webbrowser library we can then open these links right from the python terminal.

Here is a simply code that uses requests, json and webbrowser libraries harmoniously.

import requests
import json
import webbrowser
def doggie():
f = r""
page = requests.get(f) data = json.loads(page.text)["url"]) doggie()


If you need a refresher on user defined functions lesson in Python here is a link to our Defining Functions Lesson.

Source of API:

Recommended Posts