How to automate daily motivation with a little Python

Make a quote generator to text motivation to you every morning.

February 8, 2021

February is here. And, if you are like me, you can be easily bummed-out by the short days and cold weather.

To fight this bummer of a month, I set out to build an app to text me some daily motivation - in the form of an inspirational quote. It turns out this is an easy thing to do thanks to Python, a nicely curated quote database, a sweet picture of the day website, and the SMS service Twilio.

I call this app… the Quotivator (the name is still in beta).

Those dark mornings, when it is hard to get moving.

How does the Quotivator work?

The Quotivator works in four easy steps:

  1. Select a random quote from a database

  2. Scrape the image from the picture of the day website

  3. Create a markdown file with the quote and image to push to my website

  4. Text the quote to my phone number

Thanks to the magic of Python, all of this happens in under 20 lines of code! Not that anyone is counting…

After the python code is written, I simply create an executable file to run the code, and schedule that file to run once daily with Automator for Mac. If you use Windows or linux, you can schedule executable file runs using task scheduler or cron.

What does the Quotivator do?

The Quotivator provides a daily update on my website to display the quote and photo of the day. You can bookmark this page or set it as your browser’s homepage if you would like a new inspirational quote to greet you daily.

The Quotivator also texts the daily quote to my phone. I see it when I wake up in the morning, and it motivates to exercise and tackle my day - even when it is really dark and cold.

What is the Quotivator an example of?

Well, if you are just starting out coding in Python, the Quotivator is an example of many applications. Web scraping, database updating, texting from the console, and automation. All of these are powerful tools that are easily implemented using Python.

How can I get the Quotivator to text me?

To make the Quotivator yours, just fork my GitHub Repository and enter your Twilio account and key into the Python script. Then simply automate your script through automator or cron.

If you don’t want to code or just want see daily quotes on your browser, bookmark or set your homepage to my daily quote and photo page.

Quote database source: Akhil Tak’s inspirational-quotes repository on GitHub

Image source: Nature pic of the day website

SMS service for Python: Twilio

Data and Python code available on GitHub

Written on February 8, 2021


Articles by category

Articles by technology

Article archive