Skip to content

Commit b7b1b31

Browse files
committed
lab09 in progress
1 parent 5de905b commit b7b1b31

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# https://favqs.com/api/qotd
2+
3+
4+
#================================
5+
#Version1
6+
#================================
7+
8+
import requests
9+
10+
11+
12+
response = requests.get(f"https://favqs.com/api/qotd", headers={'Accept': 'application/json'})
13+
# print(response)
14+
15+
16+
random_joke = response.json()
17+
# print(random_joke)
18+
19+
20+
joke_dict = []
21+
joke_dict.append(random_joke['quote'])
22+
print("joke_dict", joke_dict)
23+
print("author", joke_dict[2])
24+
25+
26+
#================================
27+
#Version2
28+
#================================
29+
30+
31+
# get_quote = input("Enter a search term to get a random quote: ")
32+
# print(get_quote)
33+
34+
35+
36+
# # print(response.text)
37+
# print("=====================")
38+
# data = response.json()
39+
# print("=====================")
40+
# print(data)
41+
# print("=====================")
42+
43+
44+
45+
46+
47+

0 commit comments

Comments
 (0)