Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

randfacts

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

randfacts

Package to generate random facts

  • 0.22.0
  • PyPI
  • Socket score

Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc