Code Monkey home page Code Monkey logo

tangara-email-notifications's Introduction

tangara-email-notifications

Email notifications related to Tangara Sensors, when any sensor doesn't report data or isn't available.


Requirements

  • Python 3:

  • Gmail API Credentials:

    • Please follow the official instructions to get the credentials.json file, this one has a JSON structure similar to the example.credentials.json file.
    • Refresh Token:
      • This is a token.json file created when the script is first to run, this one has a JSON structure similar to the example.token.json file, this file will be used to refresh the Gmail API token. The token.json file must only have the follow structure:
{
    "token": "ya29.a0ARrdaM-3sywDwFLToHz6CuMI6X7aGzfCsh0VHcv_0S2ykDiHBTQjN_IYllDGop0TEmCdfD_XjLOBhcyQA1wCXUm0ISxyWY0p4Fm33XEeZXj2Zk_4DeC9G_BjehT3ShcRaX5ljQrV83ejBSWEqyeVNRPzhlVn",
    "refresh_token": "1//0dW7ynmcwPg-LCgYIARAAGA0SNwF-L9IrfnJg9Sy9ZdGrcL1tL9oRzdgTJxdYb86Ww4gL7jnlFn7TGclMekW5VADkJB5YQYiuL1s",
    "expiry": "2022-07-01T03:31:50.460388Z"
}

Environment Variables

Setup your own values to environment variables, use the example.env file, and save your custom values as a .env file. The .env file must be ignored from the repository

Source Code

See ./src directory.

Inputs

There are a couple of inputs to the Email Notifications, use the mailing_list.csv file to subscribe people that will be notified, They will be the people in charge of any Tangara sensor, and use the sensors.csv file to register each Tangara sensor. Please use the example.mailing_list.csv to create the mailing_list.csv file. The mailing_list.csv file must be ignored from the repository

Outputs

Here is the sensors_status.csv file, this dataset contains the report about when each Tangara sensor was down or is up.

How to use

Please read and execute each step below:

Step 1

Create and use Python virtual environment:

$promt> python -m venv .venv
$promt> source .venv/bin/activate

Step 2

Install all Python requirements:

$promt> python -m pip install -U pip
$promt> pip install -r requirements.txt

Step 3

Run Email Notifications Script:

$promt> python src/notify_subscribers.py -n -s input/sensors.csv

Optional

Generate a requirements file and then install from it in another environment:

$promt> pip freeze > requirements.txt

That's all for now ...


License

GPL-3.0 License

About me

https://about.me/sebaxtian

tangara-email-notifications's People

Stargazers

 avatar

Watchers

 avatar  avatar  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.