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