You can download this code by clicking the button below.
This code is now available for download.
The function uses the Requests library to fetch a random quote from https://api.quotable.io/random and returns the content of the quote.
Technology Stack : Requests, JSON
Code Type : Function
Code Difficulty : Beginner
import requests
import random
def get_random_quote():
response = requests.get("https://api.quotable.io/random")
data = response.json()
return data["content"]