@@ -63,7 +63,11 @@ A list of categories that the returned joke should fit in.
63
63
Options are:
64
64
` programming ` ,
65
65
` miscellaneous ` ,
66
+ <<<<<<< HEAD
66
67
` dark ` ,
68
+ =======
69
+ ` dark `
70
+ >>>>>>> 92362ac33602ee9d5baf7e11f93507b473ebe207
67
71
` pun `
68
72
69
73
If left blank it will default to use ` Any ` .
@@ -107,15 +111,15 @@ Options are:
107
111
108
112
If left blank it will default to ` json ` .
109
113
110
- #### Example
114
+ ##### Example
111
115
112
116
``` python
113
117
joke = j.get_joke(response_format = " xml" ) # Will return a joke in xml format.
114
118
```
115
119
116
120
---
117
121
118
- ### type
122
+ #### type
119
123
120
124
The type of joke returned.
121
125
Options are:
@@ -124,21 +128,21 @@ Options are:
124
128
125
129
If left blank it will default to ` Any `
126
130
127
- #### Example
131
+ ##### Example
128
132
129
133
``` python
130
134
joke = j.get_joke(type = " twopart" ) # Will return a twopart joke; both a setup and a delivery.
131
135
```
132
136
133
137
---
134
138
135
- ### search_string
139
+ #### search_string
136
140
137
141
A string to search for in jokes.
138
142
139
143
If left blank it will default to ` None `
140
144
141
- #### Example
145
+ ##### Example
142
146
143
147
``` python
144
148
joke = j.get_joke(search_string = " the" ) # Will return a joke with the word "the" in it.
@@ -147,7 +151,7 @@ If left blank it will default to `None`
147
151
148
152
---
149
153
150
- ### id_range
154
+ #### id_range
151
155
152
156
The range in which the selected joke should fall. ID's are decided by the order in which jokes are submitted.
153
157
The argument passes should be in form of list or tuple, and should not exceed length of 2 items. First item
@@ -156,36 +160,63 @@ should be minimum 0. Maximum value can be determined [here](https://sv443.net/jo
156
160
If left blank it will default to the maximum range.
157
161
158
162
159
- #### Example
163
+ ##### Example
160
164
161
165
``` python
162
166
joke = j.get_joke(id_range = [10 ,100 ]) # Will return a joke with the ID between 10 and 100.
163
167
```
164
168
165
169
---
166
170
167
- ### auth_token
171
+ #### amount
172
+
173
+ The amount of jokes you want the api to return. Will return them in a list. Maximum number is 10 jokes, and the
174
+ api defaults to 1 if you use a number larger than the maximum. Defaults to 1.
175
+
176
+
177
+ ##### Example
178
+
179
+ ``` python
180
+ joke = j.get_joke(amount = 2 ) # Will return 2 jokes.
181
+ ```
182
+
183
+ ---
184
+
185
+ #### lang
186
+
187
+ The language that the joke and response should be in. Currently supported languages are in the official api
188
+ documentation. Defaults to en.
189
+
190
+ ##### Example
191
+
192
+ ``` python
193
+ joke = j.get_joke(lang = " de" )
194
+ ```
195
+
196
+ ---
197
+
198
+ #### auth_token
168
199
169
200
A string token provided by the api owner. Using it will mean you are whitelisted by the api and can make
170
201
more requests than normal users. Defaults to None
171
202
172
203
173
- #### Example
204
+ ##### Example
174
205
175
206
``` python
176
207
joke = j.get_joke(auth_token = " aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbb" ) # Will send the token to the api in a header.
177
208
```
178
209
179
210
---
180
211
181
- ### user_agent
212
+ #### user_agent
182
213
183
214
A string sent the the api that tells the api what browser you are (pretending to be). The default user agent
184
215
is Mozilla Firefox from Windows 10 and should work fine, but the functionality is provided in case you wish
185
216
to change it
186
217
187
218
188
- #### Example
219
+ ##### Example
189
220
190
221
``` python
191
222
joke = j.get_joke(user_agent = " Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0" )
@@ -195,19 +226,19 @@ to change it
195
226
196
227
---
197
228
198
- ### return_headers
229
+ #### return_headers
199
230
200
231
A boolean value (True or False) that tells the wrapper if you wish to receive headers in the return from the function.
232
+ Will return a list instead of a single value
201
233
Defaults to False.
202
234
203
235
204
- #### Example
236
+ ##### Example
205
237
206
238
``` python
207
239
response = j.get_joke(return_headers = True )
208
240
joke = response[0 ]
209
241
headers = response[1 ]
210
- # The function returns the joke and then the headers using the "return x, y" syntax, so you can index it like a list or tuple.
211
242
212
243
print (f " Joke: { joke} " )
213
244
print (f " Headers: { headers} " )
0 commit comments