Skip to main content

Package to generate random facts

Project description

PyPI AUR version Downloads PyPI license Maintenance GitHub Issues GitHub Workflow Status GitHub followers GitHub Repo stars
Kofi Badge

Randfacts is a Python module that generates random facts. You can use randfacts.get_fact() to return a random fun fact. Disclaimer: Facts are not guaranteed to be true.

Installation

randfacts can either be installed via pip or via the AUR, whichever way you prefer.

Installation via pip:

$ pip3 install randfacts

Installation via AUR:

Via your AUR helper, like paru:

$ paru -S python-randfacts

Or manually

$ git clone https://aur.archlinux.org/python-randfacts.git && cd python-randfacts
$ makepkg -si

Usage and examples

import randfacts
x = randfacts.get_fact()
print(x)

The above example will print a random fact like: Penguins can't taste sweet or savory flavors, only sour and salty ones

This package has a filter option to filter out potentially inappropriate facts. The filter is on by default. To disable the filter, you can just set the filter_enabled parameter to False.

from randfacts import get_fact
print(get_fact(False))
# or
print(get_fact(filter_enabled=False))

get_fact also has a parameter that will make the function only return unsafe facts. This argument takes precedence over the filter_enabled argument. For example:

print(get_fact(only_unsafe=True))

If you want to access the list of facts directly, you can just import the safe_facts, unsafe_facts, or all_facts lists from the randfacts module.

Command line usage

randfacts can be executed via the command line with the following commands:

Normal execution; only SFW (safe for work) facts

$ python3 -m randfacts

The unsafe argument can be supplied to provide only NSFW (not safe for work) facts

$ python3 -m randfacts --unsafe

The mixed argument can be provided to provide both SFW and NSFW facts.

$ python3 -m randfacts --mixed

More help.

$ python3 -m randfacts --help

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

randfacts-0.22.1.tar.gz (272.4 kB view details)

Uploaded Source

Built Distribution

randfacts-0.22.1-py3-none-any.whl (273.3 kB view details)

Uploaded Python 3

File details

Details for the file randfacts-0.22.1.tar.gz.

File metadata

  • Download URL: randfacts-0.22.1.tar.gz
  • Upload date:
  • Size: 272.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for randfacts-0.22.1.tar.gz
Algorithm Hash digest
SHA256 950865fce95e2050fe5ab2b40d66f208e0b0192a0956f79dbbf582170aee35e3
MD5 838b8b3d7aebf86e3f5b1ec01c4dadbc
BLAKE2b-256 3cce4a5f13f2e3cedea8bab143f6dd228edcc103034953538e278c3b462913fe

See more details on using hashes here.

File details

Details for the file randfacts-0.22.1-py3-none-any.whl.

File metadata

  • Download URL: randfacts-0.22.1-py3-none-any.whl
  • Upload date:
  • Size: 273.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for randfacts-0.22.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b2c54af1bfc20770b64e7ca623d6b250f132f125faf7e2c9f78c739e998ead8
MD5 9f6a1f3ab1b7ffa8db57eae93672b516
BLAKE2b-256 58b26bd60403c847518e5e4d786f07e12d7e4772b8ac68af5d83447ee95dbca4

See more details on using hashes here.

Supported by

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