Coder Social home page Coder Social logo

samuelcody / check-obituaries-alert Goto Github PK

View Code? Open in Web Editor NEW

This project forked from littlehoushontheprairie/check-obituaries-alert

0.0 0.0 0.0 68 KB

Automated script to run everyday at a set time to check obituaries for certain last names from the day before.

License: BSD 3-Clause "New" or "Revised" License

Python 88.25% HTML 7.64% Dockerfile 4.11%

check-obituaries-alert's Introduction

Check Obituaries Alert

Need something that alerts you when they appear in an obituary? This script is will check legacy.com every 24 hours (default is 13:00) for a new obituary against a list of names which is passed in as a json string. Once one found, an email will be sent.

Setup

Running Locally

  1. Download repo
    • git clone https://github.com/littlehoushontheprairie/check-obituaries-alert.git
    • git checkout develop
    • git pull
    • cd check-obituaries-alert
  2. Export environment variables
  3. Run
    • python3 check-obituaries-alert.py

Building and Running as Container from Source

  1. Download repo
    • git checkout develop
    • git pull
    • cd check-obituaries-alert
  2. Export environment variables
  3. run docker-compose
    • docker-compose up --build -d

Running Container from GitHub Docker Registry (using Terminal)

  1. Download latest container
    • docker pull ghcr.io/littlehoushontheprairie/check-obituaries-alert:latest
  2. Run container
    • docker run --restart=always -d --network host \
      --name check-obituaries-alert \
      -e TZ="America/Los_Angeles" \
      -e FROM_EMAIL="[email protected]" \
      -e TO_NAME="to" \
      -e TO_EMAIL="[email protected]" \
      -e SMTP_HOST="smtp.example.com" \
      -e SMTP_USER="[email protected]" \
      -e SMTP_PASSWORD="8f5cd6729h0v5d247vc190ddcs4l2a" \
      ghcr.io/littlehoushontheprairie/check-obituaries-alert:latest
      

Running Container from GitHub Docker Registry (using docker-compose)

  1. Create docker-compose.yml file

  2. Add content.

    • version: "3.5"
      
      services:
          check-obituaries-alert:
              container_name: check-obituaries-alert
              image: ghcr.io/littlehoushontheprairie/check-obituaries-alert:latest
              restart: always
              network_mode: host
              environment:
                  TZ: America/Los_Angeles
                  FROM_EMAIL: "${FROM_EMAIL}"
                  TO_NAME: "${TO_NAME}"
                  TO_EMAIL: "${TO_EMAIL}"
                  SMTP_HOST: "${SMTP_HOST}"
                  SMTP_USER: "${SMTP_USER}"
                  SMTP_PASSWORD: "${SMTP_PASSWORD}"
              volumes:
                  - /path/to/data:/data
      
  3. Export environment variables

  4. Run docker-compose up -d

Legacy.com API

The script reads in a json file, legacy_com_search_parameters.json, which is a json object of names and location ids. The file should be located in /data and mapped correctly in the docker-compose.yml. Legacy.com API doesn't require all fields to be filled in. At least some need to be.

Structure

Inside the JSON file, it should be laid as such. Keep in mind that each object in the searchParameters only requires either firstName or lastName to search for a refine search add as many as you need.

{
    "searchParameters": [
        {
            "firstName": "John",
            "lastName": "Smith",
            "countryId": 1,
            "regionId": 29,
            "cityId": 125138
        }
    ]
}

countryId, regionId, and cityId can be found on the Legacy.com site, but here are some direct information:

Email Templates

The script reads in email templates everytime it is ran. You can customize the templates located in the templates folder. They are read in as HTML files and are injected at runtime with the information.

Structure

  • error.html - Error Template
  • index.html - Main Template

Environment Variables

Variable Required Default Example Needed by
SCRIPT_RUN_TIME false 13:00 00:00 - 23:59 Scheduler
FROM_NAME false Check Obituaries Alert Check Obituaries Alert SMTP Server (send email from)
FROM_EMAIL true --- [email protected] SMTP Server (send email from)
TO_NAME false Laura SMTP Server (send email to)
TO_EMAIL true --- [email protected] SMTP Server (send email to)
SMTP_HOST true --- smtp.example.com SMTP Server
SMTP_PORT false 465 465 SMTP Server
SMTP_EMAIL true --- [email protected] SMTP Server
SMTP_PASSWORD true --- 8f5cd6729h0v5d247vc190ddcs4l2a SMTP Server

NOTE: For security purposes, it is strong recommended that you use a generated API passwords.

check-obituaries-alert's People

Contributors

littlehoushontheprairie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.