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 pet facts python api

Pet-Facts-API A pet facts python api Project Links API :- https://pet-facts-api.vercel.app Docs :- https://fayasnoushad.github.io/Pet-Facts-API

Fayas Noushad 3 Dec 18, 2021
Moji sends text and fun facts from different APIs wit da use of a notification deamon

Moji sends text and fun facts from different APIs wit da use of a notification deamon. Can be runned via dmenu or rofi.

kshly 2 Jan 12, 2022
Random pass word generator made with python. PyQt5 module is used to design GUI.

Differences in this GUI program : Default titlebar removed Custom Minimize,Maximize and Close Buttons Drag & move window from any point Program work l

Dimuth De Zoysa 1 Jan 26, 2022
From "fixed RAnDom CRashes" to "[FIX] Fixed random crashes."

Clean Commit From fixed RAnDom CRashes to [FIX] Fixed random crashes. Clean commit helps you by auto-formating your commits to make your repos better

Mathias 3 Dec 26, 2021
A random cat fact python module

A random cat fact python module

Fayas Noushad 4 Nov 28, 2021
A Bot Which Can generate Random Account Based On Your Hits.

AccountGenBot This Bot Can Generate Account With Hits You Save (Randomly) Keyfeatures Join To Use Support Limit Account Generation Using Sql Customiza

DevsExpo 30 Oct 21, 2022
A program to generate random numbers b/w 0 to 10 using time

random-num-using-time A program to generate random numbers b/w 0 to 10 using time it uses python's in-built module datetime and an equation which retu

Atul Kushwaha 1 Oct 1, 2022
Module for remote in-memory Python package/module loading through HTTP/S

httpimport Python's missing feature! The feature has been suggested in Python Mailing List Remote, in-memory Python package/module importing through H

John Torakis 220 Dec 17, 2022
Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

Ikaros is a free financial library built in pure python that can be used to get information for single stocks, generate signals and build prortfolios

Salma Saidane 64 Sep 28, 2022
carrier.py is a Python package/module that's used to save time when programming

carrier.py is a Python package/module that's used to save time when programming, it helps with functions such as 24 and 12 hour time, Discord webhooks, etc

Zacky2613 2 Mar 20, 2022
Simple module with some functions such as generate password (get_random_string)

Simple module with some functions such as generate password (get_random_string), fix unicode strings, size converter, dynamic console, read/write speed checker, etc.

Dmitry 2 Dec 3, 2022
combs is a package used to generate all possible combinations of a given length k on a given set.

The package combs is a package used to generate all possible combinations of a given length k on a given set. The set is given as a list, and k must b

null 1 Dec 24, 2021
Hspice-Wave-Generator is a tool used to quickly generate stimuli souces of hspice format

Hspice-Wave-Generator is a tool used to quickly generate stimuli souces of hspice format. All the stimuli sources are based on `pwl` function of HSPICE and the specific complex operations of writing hspice description are encapsulated and the user only needs to provide the array input.

null 3 Aug 2, 2022
An example module hooking system, will be used in PySAMP.

An example module hooking system, will be used in PySAMP.

null 2 May 1, 2022
Originally used during Marketplace.tf's open period, this program was used to get the profit of items bought with keys and sold for dollars.

Originally used during Marketplace.tf's open period, this program was used to get the profit of items bought with keys and sold for dollars. Practically useless for me now, but can be used as an example of tkinter.

BoggoTV 1 Dec 11, 2021
Draw random mazes in python

a-maze Draw random mazes in python This program generates and draws a rectangular maze, with an entrance on one side and one on the opposite side. The

Andrea Pasquali 1 Nov 21, 2021
Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Blender pluggin (python script) that adds a randomly generated tree with random branches and bend orientations

Travis Gruber 2 Dec 24, 2021
Python program that generates random user from API

RandomUserPy Author kirito sate #modules used requests, json, tkinter, PIL, urllib, io, install requests and PIL modules from pypi pip install Pillow

kiritosate 1 Jan 5, 2022
Random Turkish name generator with realistic probabilities.

trnames Random Turkish name generator with realistic probabilities. Based on Trey Hunner's names package. Installation The package can be installed us

Kaan Öztürk 20 Jan 2, 2023