File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ response = requests .get ("https://icanhazdadjoke.com" , headers = {
2
+ 'Accept' : 'application/json'
3
+ })
4
+
5
+ print (response .text )
6
+ # joke = response.json()
7
+ # print(joke['joke'])
8
+
9
+ #version 1
10
+ joke = response .json ()
11
+ search_term = input ("Input a genre for a joke you'd like to see " )
12
+
13
+ #Think about how to do this.. First we need to figure out how to pull a singular joke. secondly
14
+
15
+ response = requests .get (f"https://icanhazdadjoke.com/search?term=${ search_term } " , headers = {
16
+ 'Accept' : 'application/json'
17
+ })
18
+ print (response .text )
19
+ joke = response .json ()
20
+ first_step = (joke ['results' ])
21
+ second_step = (first_step [0 ]['joke' ])
22
+ print (second_step )
23
+ for key in range (len (first_step )):
24
+ print (key , first_step [key ])
25
+
26
+ # joke = response.json()
27
+ # search_term = joke['golf']
28
+ # print(response.json())
29
+ # joke = response.json()
You can’t perform that action at this time.
0 commit comments