You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
342 B
13 lines
342 B
import requests
|
|
|
|
url = "https://api.chucknorris.io/jokes/random"
|
|
|
|
while(input("Next joke? q = exit") != "q"):
|
|
response = requests.get(url)
|
|
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print(f"Joke: {data["value"]}")
|
|
print(data["created_at"])
|
|
else:
|
|
print(f"Chyba: {response.status_code}")
|