This page grabs a dad joke from

Whenever the cashier at the grocery store asks my dad if he would like the milk in a bag he replies, ‘No, just leave it in the carton!’

the code

no need for me to reinvent the wheel, adapted it from this example
It required a little modification, I try to avoid adding dependancies so I made it a module and added exception handling

#!/usr/bin/env python3
"""get a random dad joke"""
import requests

class Joke:

  def __init__(self, id, contents): = id
    self.contents = contents

  def __str__(self):
    return self.contents.encode('utf-8')

def dailyjoke():
    r = requests.get('', headers={"Accept":"application/json"})
    raw_joke = r.json();
    joke = Joke(raw_joke['id'], raw_joke['joke'])
    return joke.contents
  except Exception as e:
    print ('Failed: ', e) 
    return e