A lightweight Python library for fetching jokes from the Official Joke API.
Project description
🐍 kjokes
Because a joke a day keeps all the bugs away!
A Python library made for joking
kjokes was made to allow you to fetch jokes in your code. It's lightweight, so it doesn't mess much with your efficiency. It was made using the Official Joke API
🛠️Instalation
- 1. Using normal pip
Just type
pip install kjokesin your terminalpip install kjokes
- 2. Using uv globally
Just type
uv pip install kjokesin your terminaluv pip install kjokes
- 3. Using uv for a project
Just type
uv add kjokesin your PROJECT'S terminaluv add kjokes
To be sure it works adding
py -minfront of the command is recomended
⚙️Use
Quick use in the terminal
- Type
kjokeoruv run kjokefor a jokekjoke uv run kjoke
Using kjokes in your code
- Import the library
import kjokes #(you can also shorten it with 'as', eg. import kjokes as kj)
- Get a joke
joke = kjokes.get_joke()
- You can also specify the category
joke = get_joke(category='programming') or joke = get_joke('programming')
- Print your result
print(joke) #Result: e.g. How many programmers does it take to change a lightbulb? None that's a hardware problem
- Example of a ready, working code
import kjokes as kj joke = kj.get_joke('programming') print(joke) #Result: Which song would an exception sing? Can't catch me - Avicii
🎭Categories of jokes
- general
- programming
- knock-knock
- random (default)
Type one of these exact category names into the function
🛡️Built-in reliability guardians
kjokes is designed to be "crash-proof". It handles:
- [✅] Connection Errors: Friendly messages instead of scary red tracebacks.
- [✅] Timeouts: Won't hang your terminal if the API is slow.
- [✅] Invalid Categories: Guides you to use
khelpif you mistype a category. - [✅] Server Issues: Gracefully handles 404s and 500s.
📜License
This project is licensed under the MIT License — free to use, modify, and share
Copyright 2026 Karl Evans
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kjokes-0.1.1.tar.gz.
File metadata
- Download URL: kjokes-0.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ce8ed907e48c0f2a489876bebbdda209623beb0a421375b3fac70af1519bd34
|
|
| MD5 |
953ea78f9f8eb48efb188947d24fa1ac
|
|
| BLAKE2b-256 |
057a51955976f54a752e39ad5b7942eac701c0705cd6c8ddd733a1eecb397d5b
|
File details
Details for the file kjokes-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kjokes-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1bc129ef1bb18214b26ffcd381ae8e9e8223b01fbc4a41f74d102466d20a3625
|
|
| MD5 |
f3d9ee164d55de82b2753eff1bc5abe2
|
|
| BLAKE2b-256 |
00bee9bc09f3a862e54e9de4a23fae18bc0c342ab9eac1d9ae4c115ce8f25b51
|