nokey.jokes package
Submodules
nokey.jokes.joke_api module
- class nokey.jokes.joke_api.JokeAPI(use_caching='False', cache_name='joke_api_cache', backend='sqlite', expire_after=3600)[source]
Bases:
objectA class to interact with the JokeAPI API.
- base_url
Base URL for interacting with the API.
- about
A short description of the API.
- get_docs_url()[source]
Returns the URL for the JokeAPI documentation.
- Parameters:
None –
- Returns:
The url for the API documentation.
- Return type:
string
- get_joke(category=None, lang=None, flags=None, joke_type=None, search_string=None, amount=None)[source]
Returns joke(s) matching the given parameters.
- Parameters:
category (str) – Joke category. Defaults to Any. Possible non-default values are Programming, Misc, Dark, Pin, Spooky, and Christmas.
lang (str) – Language of the joke. Defaults to en (English). Possible other values are cs (Czech), de (German), es (Spanish), fr (French), and pt (Portuguese).
flags (str) – Optional flags to blacklist. Possible values are nsfw, religious, political, racist, sexist, and explicit.
joke_type (str) – Optional parameter for either single or twopart joke(s). Defaults to None.
search_string (str) – Optional search string contained in desired joke(s). Defaults to None.
amount (int) – Number of jokes returned. Defaults to 1.
- Returns:
A dictionary containing joke(s) matching given parameters.
- Return type:
dict