Coder Social home page Coder Social logo

colin-mills / daily-debrief-notification-service Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 461 KB

Daily notification service using google sheets as data store, deployed to Heroku

License: MIT License

Python 100.00%
heroku-deployment sendgrid twilio tweepy api-service conda-environment gspread dot-environment travis-ci continuous-integration

daily-debrief-notification-service's Introduction

Daily-Debrief-notification-service

Intructions to use service as a user

  1. Fill out google form found at https://forms.gle/1i3dyhMygPTP1VNu7

  2. Wait until 8AM EST and receive your personalized news update!

  • If you wish to unsubcscribe send an email to cgm71@georgetown with your name you used on the google form

Intructions to create this service as a provider

Setup

  1. Clone or download this repository into a local directory

  2. Create a developer account for these follwing websites and record the provided API keys

  1. Make a linked google form by following this link https://docs.google.com/forms/d/1C19R3RZLThIrF_-gaqKUbxOXsmQxUxhFz8-jmfILAmQ/edit?usp=sharing and copying it into your own drive. Select "link answers to existing spreadsheet" and select the spreadsheet you just made.

  2. Make a Heroku account at https://signup.heroku.com/login

Intructions

  1. Create or activate enironment were you can manage packages from

    • If using Anaconda as your language version manager
    conda create -n yourenvname python=3.7
    
  2. Ensure that your python is working in version 3.7

    python --version
    
  3. Install all required packages

    pip install requirements.txt
    
  4. create a .env file in your root directory for your environment variables and model it as thus with your own API keys:

ALPHA Vantage API Key

ALPHAVANTAGE_API_KEY="Key"

NY Times API Key

NYTIMES_API_KEY="Key"
NYTIMES_SECRET="SecretKey"

Open Weather API

OPEN_WEATHER_API_KEY="Key"

Sports Radar

MLB_API_KEY="MLBKey"
NBA_API_KEY="NBAKey"
NFL_API_KEY="NFLKey"
NHL_API_KEY="NHLKey"

for email capabilities

SENDGRID_API_KEY="Key" 
MY_EMAIL_ADDRESS="Email" # use the email address you associated with the SendGrid service

for SMS capabilities

TWILIO_ACCOUNT_SID="Key"
TWILIO_AUTH_TOKEN="Token"
SENDER_SMS="TwilioNumber"

for tweeting capabilities

TWITTER_API_KEY="Key"
TWITTER_API_SECRET="SecretKey"
TWITTER_ACCESS_TOKEN="Token"
TWITTER_ACCESS_TOKEN_SECRET="SecretToken"

GOOGLE Sheets credential

GOOGLE_SHEET_ID="Google Seet ID"
SHEET_NAME="name of sheet with user information"
  1. Save and commit all changes and test working functionality from command line
pytest

Deployment

Heroku Command Line

If you have not used Heroku before go to https://devcenter.heroku.com/articles/heroku-cli#download-and-install to install comand line functionality

You can test if it is working by issuing these commands from the command line

heroku login

heroku apps:list

App Server Creation

Create a remote Heroku server:

heroku apps:create name-of-app

Go to the Heroku online dashboard and find the app's "heroku git url" and subsequently associate this with your git repository:

git remote add heroku REMOTE_ADDRESS 

Ensure this step worked by issuing

git remote -v

Heroku Environment Configuration

  1. Configure the entire json file "client_secret.json" as an environment variable
heroku config:set GOOGLE_API_CREDENTIALS="$(< /client_secret.json)" 
  1. In spreadsheet.py change
server = False

To

server = True

2.For each environment variable in your .env issue a respective heroku command such as

heroku config:set ALPHAVANTAGE_API_KEY="Key"

Deploy

git push heroku master

Once deployed you will need to activate the heroku scheduler to run this command everyday at your desired time.

python app/send_notification.py

Continous Integration Testing

To enable continous integration to run on each updated commit you will need to navigate to https://travis-ci.com and go to the settings of your repository and configure each of these environment variables once more.

daily-debrief-notification-service's People

Contributors

colin-mills avatar

Stargazers

 avatar  avatar

Watchers

 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.