Created
August 18, 2018 13:21
-
-
Save sovietspy2/d39f2df275a6c8eabe106a7f0e8cf0e0 to your computer and use it in GitHub Desktop.
Python3 chuck norris joke api (simple)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = "http://api.icndb.com/jokes/random" | |
def get_chuck_norris_joke(): | |
response = requests.get(url) | |
joke = dict(response.json()) | |
return joke['value']['joke'] | |
text = get_chuck_norris_joke() | |
print(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment