Skip to content

Commit 94ef454

Browse files
committed
in progress
1 parent 2d86ecc commit 94ef454

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

code/daniel/lab08-dad_api/lab08-dad_api.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,33 @@
1818
# })
1919
# ======================================================================================================
2020

21-
21+
import time
2222
import requests
2323

2424
response = requests.get("https://icanhazdadjoke.com", headers={'Accept': 'application/json'})
2525
joke = response.json()
2626

2727
# print(response.url)
28-
print(response.text)
29-
print(response.json())
30-
print(joke)
3128
# print(response.status_code)
3229
# print(response.encoding)
3330
# print(response.headers)
31+
# print(response.text)
32+
# print(response.json())
33+
34+
print(joke)
3435

36+
data = response.json()
37+
# print(data[0]['title'])
38+
for film in data:
39+
print(film['title'])
40+
print(film['release_date'])
41+
print(film['description'])
42+
print('-'*10)
3543

3644
#========================================
37-
# response = requests.get(f"https://icanhazdadjoke.com/search?term=${search_term}", headers={
38-
# 'Accept': 'application/json'
39-
# })
45+
46+
# 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.
47+
48+
49+
# response = requests.get(f"https://icanhazdadjoke.com/search?term=${search_term}", headers={'Accept': 'application/json', params=query)})
50+

0 commit comments

Comments
 (0)