Dog Pics and Videos
Random.dog 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"https://random.dog/woof.json"
page = requests.get(f)
data = json.loads(page.text)
webbrowser.open(data["url"])
doggie()
Source: Random.dog
If you need a refresher on user defined functions lesson in Python here is a link to our Defining Functions Lesson.
Source of API: Github.com/AdenFlorian