Skip to content

Commit 2d86ecc

Browse files
committed
lab work
1 parent f602c12 commit 2d86ecc

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,24 @@
1616
# response = requests.get(f"https://icanhazdadjoke.com/search?term=${search_term}", headers={
1717
# 'Accept': 'application/json'
1818
# })
19-
# ======================================================================================================
19+
# ======================================================================================================
20+
21+
22+
import requests
23+
24+
response = requests.get("https://icanhazdadjoke.com", headers={'Accept': 'application/json'})
25+
joke = response.json()
26+
27+
# print(response.url)
28+
print(response.text)
29+
print(response.json())
30+
print(joke)
31+
# print(response.status_code)
32+
# print(response.encoding)
33+
# print(response.headers)
34+
35+
36+
#========================================
37+
# response = requests.get(f"https://icanhazdadjoke.com/search?term=${search_term}", headers={
38+
# 'Accept': 'application/json'
39+
# })

0 commit comments

Comments
 (0)