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
Automator anble you to create automations on your system

WELCOME TO AUTOMATOR BETA This programm is able to create automations on your system. This programm is only an experimantal release; infact it works v

Davide 1 Jan 12, 2022
A discord group chat creator just made it because i saw people selling this stuff for like up to 40 bucks

gccreator some discord group chat tools just made it because i saw people selling this stuff for like up to 40 bucks (im currently working on a faster

baum1810 6 Oct 03, 2022
Generate Openbox Menus from a easy to write configuration file.

openbox-menu-generator Generate Openbox Menus from a easy to write configuration file. Example Configuration: ('#' indicate comments but not implement

3 Jul 14, 2022
Helps to arrange nodes

Relax brush for nodes, helps to arrange nodes easier.

336 Dec 15, 2022
Material de apoio da oficina de SAST apresentada pelo CAIS no Webinar de 28/05/21.

CAIS-CAIS Conjunto de Aplicações Intencionamente Sem-Vergonha do CAIS Material didático do Webinar "EP1. Oficina - Práticas de análise estática de cód

Fausto Filho 14 Jul 25, 2022
Uproot - A script to bring deeply nested files or directories to the surface

UPROOT Bring deeply nested files or folders to the surface Uproot helps convert

Ted 2 Jan 15, 2022
Introduction to Databases Coursework 2 (SQL) - dataset generator

Introduction to Databases Coursework 2 (SQL) - dataset generator This is python script generates a text file with insert queries for the schema.sql fi

Javier Bosch 1 Nov 08, 2021
Simple Python Gemini browser with nice formatting

gg I wasn't satisfied with any of the other available Gemini clients, so I wrote my own. Requires Python 3.9 (maybe older, I haven't checked) and opti

Sarah Taube 2 Nov 21, 2021
Trackthis - This library can be used to track USPS and UPS shipments.

Trackthis - This library can be used to track USPS and UPS shipments. It has the option of returning the raw API response, or optionally, it can be used to standardize the USPS and UPS responses so t

Aaron Guzman 0 Mar 29, 2022
Программа для практической работы №12 по дисциплине

Информатика: программа для практической работы №12 Код и блок-схема программы для практической работы №12 по дисциплине "Информатика" (I семестр). Сут

Vladislav 1 Dec 07, 2021
Tiny demo site for exploring SameSite=Lax

samesite-lax-demo Background on my blog: Exploring the SameSite cookie attribute for preventing CSRF This repo holds some tools for exploring the impl

Simon Willison 6 Nov 10, 2021
A command-line utility that creates projects from cookiecutters (project templates), e.g. Python package projects, VueJS projects.

Cookiecutter A command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python

18.6k Jan 02, 2023
🦋 hundun is a python library for the exploration of chaos.

hundun hundun is a python library for the exploration of chaos. Please note that this library is in beta phase. Example Import the package's equation

kosh 7 Nov 07, 2022
Web-based Sudoku solver built using Python. A demonstration of how backtracking works.

Sudoku Solver A web-based Sudoku solver built using Python and Python only The motivation is to demonstrate how Backtracking algorithm works. Some of

Jerry Ng 2 Dec 31, 2022
Wordle Solver

Wordle Solver Installation Install the following onto your computer: Python 3.10.x Download Page Run pip install -r requirements.txt Instructions To r

John Bucknam 1 Feb 15, 2022
RestMapper takes the pain out of integrating with RESTful APIs.

python-restmapper RestMapper takes the pain out of integrating with RESTful APIs. It removes all of the complexity with writing API-specific code, and

Lionheart Software 8 Oct 31, 2020
AndroidEnv is a Python library that exposes an Android device as a Reinforcement Learning (RL) environment.

AndroidEnv is a Python library that exposes an Android device as a Reinforcement Learning (RL) environment.

DeepMind 814 Dec 26, 2022
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
Film-dosimetry - Film dosimetry for DUVS

film-dosimetry Film dosimetry for DUVS Hi David and Joe, here we go this is a te

Christine L Kuryla 3 Jan 20, 2022
Hashcrack: Hash Bruteforse tool using python

HashCrack Hash Bruteforse tool Usage hashcrack.py -n 6 -c lower -l 5 -a md5 -t 3

Lev 1 May 04, 2022