Python module used to generate random facts

Overview

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.

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:

$ 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)

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

REST API Usage

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

Comments
  • I can't get facts from the module

    I can't get facts from the module

    Describe the bug I made a new file and ran `import randfacts

    x = randfacts.get_fact()

    print(x)`

    It is giving me
    return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2678: character maps to <undefined>

    Expected behavior It should give me a fact

    Please complete the following information:

    • OS: Windows 10
    • Python version: python 3.9.5
    • Versionn: 0.7.3
    bug 
    opened by VG08 4
  • Outdated facts still in the package.

    Outdated facts still in the package.

    I found an old fact that is now no longer true. Specifically, it's this one: "Every tweet Americans send is being archived by the Library of Congress." The Library stopped this in the year 2017 according to the date of an NPR post on the topic (https://www.npr.org/sections/thetwo-way/2017/12/26/573609499/library-of-congress-will-no-longer-archive-every-tweet).

    opened by PancakesWasTaken 2
  • Update safe.txt

    Update safe.txt

    Hi, I want to get some more experience with contributing to projects so I decided to add some facts. I don't know of any reason why I might not be able to merge them but if their is please tell me.

    opened by Parzival129 1
  • 0.2.8 build?

    0.2.8 build?

    What was changed:

    1. Removed some inconvenience from main.py
    2. Updated setup.py
    3. Rewritten most of test.py
    4. Added a try-except block in test.py to keep code consistency and to "suppress" issue #3
    opened by PancakesWasTaken 1
  • test.py failure to complete test 3/3

    test.py failure to complete test 3/3

    Bug info: The bug is a FileNotFoundError that originates in test.py and is affecting line 43 possibly line 46 (line numbers are from the current 0.2.7 master) in the file due to a blank state in the variable basedir.

    Steps to reproduce the behavior:

    1. Install the randfacts master on a test machine that is UNIX based
    2. Install randfacts master into the system using setup.py
    3. cd to tests and do sudo python3 test.py
    4. See Error

    Intended result: The test was intended to be completed successfully with no issues and terminate with no problems.

    Actual result: SEE SCREENSHOT

    Screenshot before "suppression": Screen Shot 2021-01-28 at 8 22 04 AM

    Machine info:

    • OS: MacOS Catalina 10.15.7
    • Python version: 3.8.5
    • Package Version: 0.2.7 (but was detected on a 0.2.8 dev build)

    Extras: The problem was "suppressed" by adding a try-except around the affected area.

    bug 
    opened by PancakesWasTaken 1
  • Added some more facts

    Added some more facts

    Sorry I know I just made a pull request for the 'the first programmers were women' fact, but I accidentally added that to your repo instead of my forked one. This is the one that actually had a good number of new facts. Sorry for the confusing pull requests I'm still a bit new.

    opened by Parzival129 0
  • Added/modified several more things in the randfacts package

    Added/modified several more things in the randfacts package

    Changes:

    1. Premade test script for dev testing purposes

    2. Grammar and correction of safe.txt

    3. Updated .gitignore to ignore .DS_Store for Mac development purposes

    4. Added a very important note to setup.py

    5. Added a basic getVersion() function

    6. init.py was modified to include modification 5.

    NOTE: To change the version, follow the note in setup.py and change the version variable in main.py

    opened by PancakesWasTaken 0
Releases(v0.19.0)
Owner
Tabulate
I currently like desktop development the most. Proficient in Python, Bash, JavaScript, and HTML/CSS. Some experience with Rust and Java. I use arch btw
Tabulate
A supercharged version of paperless: scan, index and archive all your physical documents

Paperless-ng Paperless (click me) is an application by Daniel Quinn and contributors that indexes your scanned documents and allows you to easily sear

Jonas Winkler 5.3k Jan 09, 2023
This is where I learn machine learning

This is where I learn machine learningπŸ€·β€ This means that this repo covers no specific topic of machine learning or a project - I work in here when I want to learn/try something

Wilhelm Berghammer 47 Nov 16, 2022
Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. πŸ’›πŸ’™πŸ’š

Collection of tools to be more productive in your work environment and to avoid certain repetitive tasks. πŸ’›πŸ’™πŸ’š

Raja Rakotonirina 2 Jan 10, 2022
Python module for creating the circuit simulation definitions for Elmer FEM

elmer_circuitbuilder Python module for creating the circuit simulation definitions for Elmer FEM. The circuit definitions enable easy setup of coils (

5 Oct 03, 2022
Your copilot to studies and work (Pomodoro-timer, Translate and Notes app)

Copylot Your copilot to studies and work (Pomodoro-timer, Translate and Notes app) Copylot are three applications in one: Pomodoro Translate Notes Cop

Eduardo Mendes 20 Dec 16, 2022
Larvamatch - Find your larva or punk match.

LarvaMatch Find your larva or punk match. UI TBD API (not started) The API will allow you to specify a punk by token id to find a larva match, and vic

1 Jan 02, 2022
RFDesign - Protein hallucination and inpainting with RoseTTAFold

RFDesign: Protein hallucination and inpainting with RoseTTAFold Jue Wang (juewan

139 Jan 06, 2023
A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

A python script based on OpenCV-Python, you can automatically hang up the Destiny 2 Throne to get the Dawning Essence.

1 Dec 19, 2021
My repository for the Advent of Code, starting from 2021

Advent of Code This is my repository for the Advent of Code (https://adventofcode.com/), starting from 2021. File Structure Inside each year folder, s

Yu-Ting 6 Dec 15, 2021
Manage Procfile-based applications

Foreman Manage Procfile-based applications Installation $ gem install foreman Ruby users should take care not to install foreman in their project's G

David Dollar 5.8k Jan 03, 2023
Example applications, dashboards, scripts, notebooks, and other utilities built using Polygon.io

Polygon.io Examples Example applications, dashboards, scripts, notebooks, and other utilities built using Polygon.io. Examples Preview Name Type Langu

Tim Paine 4 Jun 01, 2022
This is the community maintained fork of ungleich's cdist (after f061fb1).

cdist This is the community maintained fork of ungleich's cdist (after f061fb1). Work is split between three repositories: cdist - implementation of t

cdist community edition 0 Aug 02, 2022
A program that makes all 47 textures of Optifine CTM only using 2 textures

A program that makes all 47 textures of Optifine CTM only using 2 textures

1 Jan 22, 2022
A wrapper for the apt package manager.

A wrapper for the apt package manager.

531 Jan 04, 2023
Forward RSS feeds to your email address, community maintained

Getting Started With rss2email We highly recommend that you watch the rss2email project on GitHub so you can keep up to date with the latest version,

248 Dec 28, 2022
Persistent/Immutable/Functional data structures for Python

Pyrsistent Pyrsistent is a number of persistent collections (by some referred to as functional data structures). Persistent in the sense that they are

Tobias Gustafsson 1.8k Dec 31, 2022
A reminder for stand-up roster

roster-reminder A reminder for stand-up roster Run the project Setup database The project use SQLite as database. You can create tables refer to roste

Jason Zhang 5 Oct 28, 2022
adbsync - An ADB syncing helper

adbsync - An ADB syncing helper What's this? Everytime I wanted to make a backup of my phone, or restore those files onto it, I had to use everytime t

Giovanni Gualtieri 3 Aug 05, 2022
LAPS module for CrackMapExec

Crackmapexec-LAPS LAPS module for CrackMapExec Make sure to point to the DC Specify the full domain name Be careful the rid 500 might not be "Administ

28 Oct 05, 2022
Write a program that works out whether if a given year is a leap year

Leap Year πŸ’ͺ This is a Difficult Challenge πŸ’ͺ Instructions Write a program that works out whether if a given year is a leap year. A normal year has 36

Rodrigo Santos 0 Jun 22, 2022