Forismatic offers inspirational expressions in the form of a Windows screensaver and quotes tray, iPhone and Mac OS application, an Android client and API.
Table of contents
Introduction to Forismatic
An inspirational quote will always be a way to brighten up someone’s day. Forismatic.com is an excellent site with some solid APIs to get inspirational expressions in the form of a Windows screensaver, a quotes tray, iPhone and Mac OS applications and an Android client.
“Here we collect the most inspiring expressions of mankind.
There are not any catalogues of phrases or lists of authors on the site, full of sages and philosophers’ thoughts, writers and outstanding people’s aphorisms. We don’t believe in a random choice. Only you can guide your destiny. Just listen to yourself and one of the most inspiring expressions of mankind will be the sign for you.”
- Get the ROCCAT Burst Pro PC Gaming Mouse from Amazon.com
- Get the LG 22MK430H-B 21.5″ Full HD Monitor from Amazon.com
- Get the Corsair K95 RGB Platinum XT Mechanical Gaming Keyboard from Amazon.com
The Forismatic API
What is also handy is Forismatic’s API functionality. Random inspirational expressions can be called from, among other languages, Python libraries.
The current version of their API is 1.0. Expressions can be obtained in English (en) or Russian (ru).
API method calls are implemented in the form of HTTP requests to the URL
http://api.forismatic.com/api/1.0/
Query parameters are passed using POST
or GET
(URL-encoded) method. The server return data format is set by the query parameter. The following response formats are supported:
- xml
- json
- jsonp
- html
- text
For more information, see the official Forismatic API section, but for those with less programming experience see the Python section below.
Python
Currently, there are at least two working Python libraries that can be used to obtain expressions, pyforismatic and notify-quote. After installation, these libraries are imported into the Python script which will then only need a simple command to retrieve a random quote.
pyforismatic
Andrey Basalyha wrote a nice, easy-to-use repository called pyforismatic, for this function. It is available on Bitbucket. To copy and unzip and install the repository to a Raspberry Pi, use the following lines in the terminal (while being in the desired base directory):
wget https://bitbucket.org/abasalyha/pyforismatic/downloads/forismatic-1.0.zip unzip forismatic-1.0.zip cd forismatic-1.0 sudo python setup.py install
After this, testing is as simple as running python example.py
from the same directory. pyforismatic will automatically get quotes in English.
notify-quote
notify-quote is a GitHub repository written by Nithish Sankaranarayanan. To copy and unzip the repository to a Raspberry Pi, go to the desired base directory and use the following lines in the terminal:
wget https://github.com/snithish/notify-quote/archive/master.zip unzip master.zip cd notify-quote-master
Testing is as simple as running python notify-quote.py
from the same directory.
Rate limitations
According to Forismatic, they have a “smart algorithm to ban host and apps that request quotes more frequently than humans read them”. When it is overused, the user will be banned.