Skip to content

Commit f602c12

Browse files
committed
make lab 8
1 parent 0ffd278 commit f602c12

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Lab 08: Dad Joke API
2+
3+
# Use the Dad Joke API to get a dad joke and display it to the user. You may want to also use time.sleep to add suspense.
4+
# Part 1
5+
6+
# Use the requests library to send an HTTP request to https://icanhazdadjoke.com/ with the Accept header as application/json. This will return a dad joke in JSON format. You can then use the .json() method on the response to get a dictionary. Get the joke out of the dictionary and show it to the user.
7+
8+
# response = requests.get("https://icanhazdadjoke.com", headers={
9+
# 'Accept': 'application/json'
10+
# })
11+
12+
# Part 2
13+
14+
# Add the ability to "search" for jokes using another endpoint. Create a REPL that allows one to enter a search term and go through jokes one at a time.
15+
16+
# response = requests.get(f"https://icanhazdadjoke.com/search?term=${search_term}", headers={
17+
# 'Accept': 'application/json'
18+
# })
19+
# ======================================================================================================

0 commit comments

Comments
 (0)