Skip to content

Commit 3435811

Browse files
authored
Update README.md
1 parent 6fad845 commit 3435811

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed

README.md

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Options are:
5555
`programming`,
5656
`miscellaneous`,
5757
`dark`
58+
`pun`
5859

5960
If left blank it will default to use `Any`.
6061

@@ -97,15 +98,15 @@ Options are:
9798

9899
If left blank it will default to `json`.
99100

100-
#### Example
101+
##### Example
101102

102103
```python
103104
joke = j.get_joke(response_format="xml") # Will return a joke in xml format.
104105
```
105106

106107
---
107108

108-
### type
109+
#### type
109110

110111
The type of joke returned.
111112
Options are:
@@ -114,21 +115,21 @@ Options are:
114115

115116
If left blank it will default to `Any`
116117

117-
#### Example
118+
##### Example
118119

119120
```python
120121
joke = j.get_joke(type="twopart") # Will return a twopart joke; both a setup and a delivery.
121122
```
122123

123124
---
124125

125-
### search_string
126+
#### search_string
126127

127128
A string to search for in jokes.
128129

129130
If left blank it will default to `None`
130131

131-
#### Example
132+
##### Example
132133

133134
```python
134135
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`
137138

138139
---
139140

140-
### id_range
141+
#### id_range
141142

142143
The range in which the selected joke should fall. ID's are decided by the order in which jokes are submitted.
143144
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
146147
If left blank it will default to the maximum range.
147148

148149

149-
#### Example
150+
##### Example
150151

151152
```python
152153
joke = j.get_joke(id_range=[10,100]) # Will return a joke with the ID between 10 and 100.
153154
```
154155

155156
---
156157

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
158186

159187
A string token provided by the api owner. Using it will mean you are whitelisted by the api and can make
160188
more requests than normal users. Defaults to None
161189

162190

163-
#### Example
191+
##### Example
164192

165193
```python
166194
joke = j.get_joke(auth_token="aaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbb") # Will send the token to the api in a header.
167195
```
168196

169197
---
170198

171-
### user_agent
199+
#### user_agent
172200

173201
A string sent the the api that tells the api what browser you are (pretending to be). The default user agent
174202
is Mozilla Firefox from Windows 10 and should work fine, but the functionality is provided in case you wish
175203
to change it
176204

177205

178-
#### Example
206+
##### Example
179207

180208
```python
181209
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
185213

186214
---
187215

188-
### return_headers
216+
#### return_headers
189217

190218
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
191220
Defaults to False.
192221

193222

194-
#### Example
223+
##### Example
195224

196225
```python
197226
response = j.get_joke(return_headers=True)
198227
joke = response[0]
199228
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.
201229

202230
print(f"Joke: {joke}")
203231
print(f"Headers: {headers}")

0 commit comments

Comments
 (0)