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

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


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

Installation via pip:

$ pip3 install randfacts

Installation via AUR:

$ git clone && cd python-randfacts
$ makepkg -si

Usage and examples

import randfacts
x = randfacts.get_fact()

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
# or

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:


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 safe facts

$ python3 -m randfacts

The unsafe argument can be supplied to provide only unsafe facts

$ python3 -m randfacts --unsafe

The mixed argument can be provided to provide both safe and unsafe facts.

$ python3 -m randfacts --mixed

More help.

$ python3 -m randfacts --help


There is an unofficial REST API for this module. The source code/links can be found here.

Project details

Download files

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

Files for randfacts, version 0.15.0
Filename, size File type Python version Upload date Hashes
Filename, size randfacts-0.15.0-py3-none-any.whl (257.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size randfacts-0.15.0.tar.gz (256.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page