File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -115,19 +115,20 @@ If left blank it will default to `json`.
115115
116116---
117117
118- #### type
118+ #### joke_type
119119
120120The type of joke returned.
121121Options are:
122122` single ` ,
123- ` twopart `
123+ ` twopart ` ,
124+ ` Any `
124125
125126If left blank it will default to ` Any `
126127
127128##### Example
128129
129130``` python
130- joke = j.get_joke(type = " twopart" ) # Will return a twopart joke; both a setup and a delivery.
131+ joke = j.get_joke(joke_type = " twopart" ) # Will return a twopart joke; both a setup and a delivery.
131132```
132133
133134---
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def build_request(
3333 category = [],
3434 blacklist = [],
3535 response_format = "json" ,
36- type = "Any" ,
36+ joke_type = "Any" ,
3737 search_string = "" ,
3838 id_range = [],
3939 amount = 1 ,
@@ -82,15 +82,15 @@ def build_request(
8282 raise ResponseTypeError (
8383 "Response format must be either json, xml, txt or yaml."
8484 )
85- if type :
86- if type not in ["single" , "twopart" ]:
85+ if joke_type :
86+ if joke_type not in ["single" , "twopart" , "Any " ]:
8787 raise JokeTypeError (
8888 '''Invalid joke type.
8989 Available options are "single" or "twopart".'''
9090 )
9191 return
9292 else :
93- type = "Any"
93+ joke_type = "Any"
9494
9595 if search_string :
9696 if not isinstance (search_string , str ):
@@ -119,7 +119,7 @@ def build_request(
119119 if blacklistFlags :
120120 r += f"&blacklistFlags={ blacklistFlags } "
121121
122- r += f"&type={ type } "
122+ r += f"&type={ joke_type } "
123123
124124 if search_string :
125125 r += f"&contains={ search_string } "
@@ -192,7 +192,7 @@ def get_joke(
192192 category = [],
193193 blacklist = [],
194194 response_format = "json" ,
195- type = "Any" ,
195+ joke_type = "Any" ,
196196 search_string = "" ,
197197 id_range = [],
198198 amount = 1 ,
@@ -206,7 +206,7 @@ def get_joke(
206206 category ,
207207 blacklist ,
208208 response_format ,
209- type ,
209+ joke_type ,
210210 search_string ,
211211 id_range ,
212212 amount ,
Original file line number Diff line number Diff line change 7676
7777"""Testing for errors in type"""
7878try :
79- j .get_joke (type = "single" , auth_token = token )
79+ j .get_joke (joke_type = "single" , auth_token = token )
8080except Exception as e :
8181 errors .append ({'Error in' : 'type single' , 'Error' : e })
8282
8383try :
84- j .get_joke (type = "twopart" , auth_token = token )
84+ j .get_joke (joke_type = "twopart" , auth_token = token )
8585except Exception as e :
8686 errors .append ({'Error in' : 'type double' , 'Error' : e })
8787
You can’t perform that action at this time.
0 commit comments