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
Tutorials for on-ramping to StarkNet

Full-Stack StarkNet Repo containing the code for a short tutorial series I wrote while diving into StarkNet and learning Cairo. Aims to onramp existin

Sam Barnes 71 Dec 07, 2022
用于导出墨墨背单词的词库,并生成适用于 List 背单词,不背单词,欧陆词典等的自定义词库

maimemo-export 用于导出墨墨背单词的词库,并生成适用于 List 背单词,欧陆词典,不背单词等的自定义词库。 仓库内已经导出墨墨背单词所有自带词库(暂不包括云词库),多达 900 种词库,可以在仓库中选择需要的词库下载(下载单个文件的方法),也可以去 蓝奏云(密码:666) 下载打包好

ourongxing 293 Dec 29, 2022
Automates the fixing of problems reported by yamllint by parsing its output

yamlfixer yamlfixer automates the fixing of problems reported by yamllint by parsing its output. Usage This software automatically fixes some errors a

OPT Nouvelle Caledonie 26 Dec 26, 2022
Turn your IPad into a Screen-Slaver with 1 simple Pythonista script

ScreenSlaver Turn your IPad into a Screen-Slaver with 1 simple Pythonista script

6 Jul 09, 2022
Why write code when you can import it directly from GitHub Copilot?

Copilot Importer Why write code when you can import it directly from GitHub Copilot? What is Copilot Importer? The copilot python module will dynamica

Mythic 41 Jan 04, 2023
The Great Autoencoder Bake Off

The Great Autoencoder Bake Off The companion repository to a post on my blog. It contains all you need to reproduce the results. Features Currently fe

Tilman Krokotsch 61 Jan 06, 2023
People tracker on the Internet: OSINT analysis and research tool by Jose Pino

trape (stable) v2.0 People tracker on the Internet: Learn to track the world, to avoid being traced. Trape is an OSINT analysis and research tool, whi

Jose Pino 7.3k Dec 30, 2022
Automate your Microsoft Learn Student Ambassadors event certificate with Python

Microsoft Learn Student Ambassador Certificate Automation This repo simply use a template certificate docx file and generates certificates both docx a

Muhammed Oğuz 24 Aug 24, 2022
Learning a Little about Containerlab

Learning a Little about Containerlab Hello all. This is the respository based on this blog post. Getting Started Feel free to use this example. You wi

10 Oct 16, 2022
Grammar of Scalable Linked Interactive Nucleotide Graphics

Gosling.js Gosling.js is a declarative grammar for interactive (epi)genomics visualization on the Web. ⚠️ Please be aware that the grammar of Gosling.

Gosling 126 Nov 29, 2022
Linux Backlight Manager

Is a program to manage your laptop keyboard backlights in linux. Tested on Tuxedo / Clevo / Monste models. Must be tested on other devices

Arshia Ihammi 4 Jan 14, 2022
Types for the Rasterio package

types-rasterio Types for the rasterio package A work in progress Install Not yet published to PyPI pip install types-rasterio These type definitions

Kyle Barron 7 Sep 10, 2021
FileTransfer - to exchange files from phone to laptop

A small website I locally host on my network to exchange files from my phone and other devices to my laptop.

Ronak Badhe 4 Feb 15, 2022
TurtleBot Control App - TurtleBot Control App With Python

TURTLEBOT CONTROL APP INDEX: 1. Introduction 2. Environments 2.1. Simulated Envi

Rafanton 4 Aug 03, 2022
Weblate is a copylefted libre software web-based continuous localization system

Weblate is a copylefted libre software web-based continuous localization system, used by over 2500 libre projects and companies in more than 165 count

Weblate 7 Dec 15, 2022
Render your templates using .txt files

PizzaX About Run Run tests To run the tests, open your terminal and type python tests.py (WIN) or python3 tests.py (UNX) Using the function To use the

Marcello Belanda 2 Nov 24, 2021
It's a repo for Cramer's rule, which is some math crap or something idk

It's a repo for Cramer's rule, which is some math crap or something idk (just a joke, it's not crap; don't take that seriously, math teachers)

Module64 0 Aug 31, 2022
Nextstrain build targeted to Omicron

About This repository analyzes viral genomes using Nextstrain to understand how SARS-CoV-2, the virus that is responsible for the COVID-19 pandemic, e

Bedford Lab 9 May 25, 2022
Scripts to convert the Ted-MDB corpora into the formats for DISRPT shared task and the converted corpora

Scripts to convert the Ted-MDB corpora into the formats for DISRPT shared task and the converted corpora.

1 Feb 08, 2022
A python tool for synchronizing the messages from different threads, processes, or hosts.

Sync-stream This project is designed for providing the synchoronization of the stdout / stderr among different threads, processes, devices or hosts.

Yuchen Jin 0 Aug 11, 2021