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
monster hunter world randomizer project

mhw_randomizer monster hunter world randomizer project Settings are in rando_config.py Current script for attack randomization is n mytest.py There ar

2 Jan 24, 2022
A Python Based Utility for Processing GST-Return JSON Files to Multiple Formats

GSTR 1/2A Utility by Shan.tk Open Source GSTR 1/GSTR 2A JSON to Excel utility based on Python. Useful for Auditors in Verifying GSTR 1 Return Invoices

Sudharshan TK 1 Oct 08, 2022
A series of basic programs written in Python

Primeros programas en Python Una serie de programas básicos escritos en Python

Madirex 1 Feb 15, 2022
Doom o’clock is a website/project that features a countdown of “when will the earth end” and a greenhouse gas effect emission prediction that’s predicted

Doom o’clock is a website/project that features a countdown of “when will the earth end” and a greenhouse gas effect emission prediction that’s predicted

shironeko(Hazel) 4 Jan 01, 2022
Datasets with Softcatalà website content

softcatala-web-dataset This repository contains Sofcatalà web site content (articles and programs descriptions). Dataset are available in the dataset

Softcatalà 2 Dec 26, 2021
The program converts Swiss notes into American notes

Informatik-Programmieren Einleitung: Das Programm rechnet Schweizer Noten in das Amerikanische Noten um. Der Benutzer kann seine Note eingeben und der

2 Dec 16, 2021
Submission from Team OMR for the TRI-NIT Hackathon

Submission from Team OMR for the TRI-NIT Hackathon

0 Feb 01, 2022
Replay Felica Exchange For Python

FelicaReplay Replay Felica Exchange Description Standalone Replay Module Usage Save FelicaRelay (=2.0) output to file, then python replay.py [FILE].

3 Jul 14, 2022
Fused multiply-add (with a single rounding) for Python.

pyfma Fused multiply-add for Python. Fused multiply-add computes (x*y) + z with a single rounding. Useful for dot products, matrix multiplications, po

Nico Schlömer 18 Nov 08, 2022
Cross-platform config and manager for click console utilities.

climan Help the project financially: Donate: https://smartlegion.github.io/donate/ Yandex Money: https://yoomoney.ru/to/4100115206129186 PayPal: https

3 Aug 31, 2021
This is friendlist update tools & old idz clon & follower idz clon etc

This is friendlist update tools & old idz clon & follower idz clon etc

MAHADI HASAN AFRIDI 1 Jan 15, 2022
Vaccine for STOP/DJVU ransomware, prevents encryption

STOP/DJVU Ransomware Vaccine Prevents STOP/DJVU Ransomware from encrypting your files. This tool does not prevent the infection itself. STOP ransomwar

Karsten Hahn 16 May 31, 2022
Demo of a WAM Prolog implementation in Python

Prol: WAM demo This is a simplified Warren Abstract Machine (WAM) implementation for Prolog, that showcases the main instructions, compiling, register

Bruno Kim Medeiros Cesar 62 Dec 26, 2022
Play tic-tac-toe in PowerPoint

The presentation has around 6,000 slides representing every possible game state (and some impossible ones, since I didn't check for wins or ties). You play by clicking on the squares, which are hyper

Jesse Li 3 Dec 18, 2021
Control your gtps with gtps-tools!

Note Please give credit to me! Do not try to sell this app, because this app is 100% open source! Do not try to reupload and rename the creator app! S

Jesen N 6 Feb 16, 2022
A simple program which gets a file(CSV/Excel) with tasks and creates different variants

TestMakerProject A simple program which gets a file(CSV/Excel) with tasks and creates different variants The main program is QTengine.py You only have

George 3 Nov 18, 2021
Create a simple program by applying the use of class

TUGAS PRAKTIKUM 8 💻 Nama : Achmad Mahfud NIM : 312110520 Kelas : TI.21.C5 Perintah : Buat program sederhana dengan mengaplikasikan pengguna

Achmad Mahfud 1 Dec 23, 2021
Karte der Allgemeinverfügungen zu Schulschließungen oder eingeschränktem Regelbetrieb in Sachsen

SNSZ Karte Datenquelle: Allgemeinverfügungen zu Schulschließungen oder eingeschränktem Regelbetrieb in Sachsen Sächsisches Staatsministerium für Kultu

Jannis Leidel 3 Sep 26, 2022
This script provides LIVE feedback for On-The-Fly data collection with RELION

README This script provides LIVE feedback for On-The-Fly data collection with RELION (very useful to explore already processed datasets too!) Creating

cryoEM CNIO 6 Jul 14, 2022
An easy way to access to your EPITECH subjects based on the Roslyn's database.

An easy way to access to your EPITECH subjects based on the Roslyn's database.

Mathias 1 Feb 09, 2022