Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 358 Bytes

README.md

File metadata and controls

17 lines (14 loc) · 358 Bytes

git-workshop

from urllib.request import Request, urlopen

def fetch_random_dad_joke() -> str:
    req = Request(
        url="https://icanhazdadjoke.com/",
        headers={
            "Accept": "text/plain",
            "User-Agent": "Workshop"
        }
    )
    return urlopen(req).read().decode("utf-8")

print(fetch_random_dad_joke())