File: api.md

package info (click to toggle)
pyjokes 0.5.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 476 kB
  • sloc: python: 387; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# API Reference

Import the pyjokes module to access `pyjokes` in any Python application:

```python
import pyjokes
```

## pyjokes.get_joke()

Returns a random joke from the given category in the given language.

| Parameters | Types | Values | Default |
| ---------- | ----- | ------ | ------- |
| language   | str   | 'en', 'de', 'es' | 'en' |
| category   | str   | 'neutral', 'adult', 'chuck', 'all' | 'neutral' |

Return type: str

If the `language` value provided is not available, a `LanguageNotFoundError` exception is raised.

If the `category` value provided is not available, a `CategoryNotFoundError` exception is raised.

## pyjokes.get_jokes()

Returns a list of jokes from the given category in the given language.

| Parameters | Types | Values | Default |
| ---------- | ----- | ------ | ------- |
| language   | str   | 'en', 'de', 'es' | 'en' |
| category   | str   | 'neutral', 'adult', 'chuck', 'all' | 'neutral' |

Return type: list

If the `language` value provided is not available, a `LanguageNotFoundError` exception is raised.

If the `category` value provided is not available, a `CategoryNotFoundError` exception is raised.