Skip to content

icyflame/excerpts_bot

 
 

Repository files navigation

Excerpts Bot - Email

A bot to send you an email daily that contains a randomly selected highlight from the books you have read

Currently, reads highlights from Kindle notebooks (CSV files) and sends email via Sendgrid. Original repository here.

TOC

Original

This was originally Nishant Nikhil's idea.

His repository has code to post the randomly chosen highlight on Twitter every 12 hours.

Environment Variables

Check the .env.template file

Usage

Local setup

Setup

$ git clone https://github.com/icyflame/excerpts_bot.git
$ cd excerpts_bot
$ mkdir -p dir_to_lookup
$ cp .env.template .env

You can put your Kindle notebooks into /dir_to_lookup. And see the .env file for the environment variables that are required for this script to run. Once these have been completed, you can run the script using:

$ python3 tweebot.py

Using Cron

Running the tweebot.py script with the required environment variables will send a single email. You can use cron to make this a periodic email.

* 10 * * * python3 /media/username/code/excerpts_bot/tweebot.py

Dockerized setup

  1. Get an instance on your preferred cloud provider

    1. You can use the cheapest instance the provider offers
    2. This is only a cron that is going to run once and doesn't need any significant RAM or Hard Disk
    3. If you already have an app instance, you can run this together with that as well (Thanks, Docker!)
  2. SSH into your instance

  3. Follow the steps in Local Setup > Setup

  4. Build the docker container:

    docker build . -t excerpts:latest
  5. Run the docker container:

    docker run --name excerpts -d excerpts:latest

By default, the script is set to run once a while. The base docker image is alpine and alpine has the convenient /etc/periodic/daily which runs the script once every day at 2 am.

License

Code licensed under MIT

Copyright (C) 2018 Siddharth Kannan mail@siddharthkannan.in

About

For goodfellas by goodfella

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 69.9%
  • Shell 24.5%
  • Dockerfile 5.6%