Skip to main content

A fun Python package that provides jokes for developers

Project description

下面是一个符合 PyPI 发布规范的 README.md(可直接使用),结构、格式、badge、安装方式、示例、测试说明都已整理好,适合直接上传到 PyPI / GitHub。


Joke Center 🎭

A simple and extensible Python library for managing and retrieving jokes by category.

🚀 Features

  • Get random jokes by category
  • Add and delete jokes dynamically
  • Retrieve jokes across all categories
  • List available categories
  • Get multiple jokes at once
  • Built-in statistics support
  • Fully tested with pytest

📦 Installation

Install via pip:

pip install joke-center

🔧 Usage

Basic Example

import joke_center

# Get a joke
print(joke_center.get_joke("programming"))

# Add a joke
joke_center.add_joke("programming", "Debugging is like being the detective in a crime movie where you are also the murderer.")

# Get random joke from all categories
print(joke_center.get_random_joke())

# List categories
print(joke_center.list_categories())

📚 API Reference

get_joke(category="programming")

Return a random joke from a category.


add_joke(category, joke)

Add a new joke.

  • Returns error if joke is empty

delete_joke(category, joke)

Delete a joke from a category.


list_categories()

Return all available categories.


get_random_joke()

Return a random joke from all categories.


get_all_jokes(category)

Return all jokes in a category.


get_multiple_jokes(category, n=1)

Return multiple random jokes.


get_stats()

Return statistics:

{
  "total_categories": 3,
  "total_jokes": 10
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

joke_center_wszms384-0.1.1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

joke_center_wszms384-0.1.1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file joke_center_wszms384-0.1.1.tar.gz.

File metadata

  • Download URL: joke_center_wszms384-0.1.1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for joke_center_wszms384-0.1.1.tar.gz
Algorithm Hash digest
SHA256 71f723f1d633d5d23f315a8b804179fdf8681e06b591ea7d739a6cdedbe19ebf
MD5 d79d8a47baa5b28a6ca345b208a1b5d8
BLAKE2b-256 f84b141e8c384f8915c8cff4c6f51984df368cef72cd02eb5136a0e2c7555e2a

See more details on using hashes here.

File details

Details for the file joke_center_wszms384-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for joke_center_wszms384-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b899ec506950dcc5a9512a71316c40f85b45080c98fe43615de20e2ce6aa88f5
MD5 efc1136f71cc6e9a51da61f65d04fd0d
BLAKE2b-256 302ff90e5f948aeb694cefcf676d0ffbcfd90b722f2db7cecd4b7aea3755e111

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page