File tree 3 files changed +13
-12
lines changed
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`.
115
115
116
116
---
117
117
118
- #### type
118
+ #### joke_type
119
119
120
120
The type of joke returned.
121
121
Options are:
122
122
` single ` ,
123
- ` twopart `
123
+ ` twopart ` ,
124
+ ` Any `
124
125
125
126
If left blank it will default to ` Any `
126
127
127
128
##### Example
128
129
129
130
``` 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.
131
132
```
132
133
133
134
---
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def build_request(
33
33
category = [],
34
34
blacklist = [],
35
35
response_format = "json" ,
36
- type = "Any" ,
36
+ joke_type = "Any" ,
37
37
search_string = "" ,
38
38
id_range = [],
39
39
amount = 1 ,
@@ -82,15 +82,15 @@ def build_request(
82
82
raise ResponseTypeError (
83
83
"Response format must be either json, xml, txt or yaml."
84
84
)
85
- if type :
86
- if type not in ["single" , "twopart" ]:
85
+ if joke_type :
86
+ if joke_type not in ["single" , "twopart" , "Any " ]:
87
87
raise JokeTypeError (
88
88
'''Invalid joke type.
89
89
Available options are "single" or "twopart".'''
90
90
)
91
91
return
92
92
else :
93
- type = "Any"
93
+ joke_type = "Any"
94
94
95
95
if search_string :
96
96
if not isinstance (search_string , str ):
@@ -119,7 +119,7 @@ def build_request(
119
119
if blacklistFlags :
120
120
r += f"&blacklistFlags={ blacklistFlags } "
121
121
122
- r += f"&type={ type } "
122
+ r += f"&type={ joke_type } "
123
123
124
124
if search_string :
125
125
r += f"&contains={ search_string } "
@@ -192,7 +192,7 @@ def get_joke(
192
192
category = [],
193
193
blacklist = [],
194
194
response_format = "json" ,
195
- type = "Any" ,
195
+ joke_type = "Any" ,
196
196
search_string = "" ,
197
197
id_range = [],
198
198
amount = 1 ,
@@ -206,7 +206,7 @@ def get_joke(
206
206
category ,
207
207
blacklist ,
208
208
response_format ,
209
- type ,
209
+ joke_type ,
210
210
search_string ,
211
211
id_range ,
212
212
amount ,
Original file line number Diff line number Diff line change 76
76
77
77
"""Testing for errors in type"""
78
78
try :
79
- j .get_joke (type = "single" , auth_token = token )
79
+ j .get_joke (joke_type = "single" , auth_token = token )
80
80
except Exception as e :
81
81
errors .append ({'Error in' : 'type single' , 'Error' : e })
82
82
83
83
try :
84
- j .get_joke (type = "twopart" , auth_token = token )
84
+ j .get_joke (joke_type = "twopart" , auth_token = token )
85
85
except Exception as e :
86
86
errors .append ({'Error in' : 'type double' , 'Error' : e })
87
87
You can’t perform that action at this time.
0 commit comments