Skip to content

prof-rossetti/daily-briefings-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Daily Briefings App (Python)

Sends you a customized email every morning, with information of interest, such as the upcoming weather forecast for your zip code.

Installation

Create a copy of this template repo, then clone or download your new repo onto your local computer (for example to the Desktop), and navigate there from the command-line:

cd ~/Desktop/daily-briefings-py/

Use Anaconda to create and activate a new virtual environment, perhaps called "briefings-env":

conda create -n briefings-env python=3.8
conda activate briefings-env

Then, within an active virtual environment, install package dependencies:

pip install -r requirements.txt

Configuration

Follow these SendGrid setup instructions to sign up for a SendGrid account, configure your account's email address (i.e. SENDER_EMAIL_ADDRESS), and obtain an API key (i.e. SENDGRID_API_KEY).

Create a new file called ".env" in the root directory of this repo, and paste the following contents inside, using your own values as appropriate:

# these are example contents for the ".env" file:

# required vars:
SENDGRID_API_KEY="_______________"
SENDER_EMAIL_ADDRESS="_______________"

# optional vars:
#APP_ENV="development"
#COUNTRY_CODE="US"
#ZIP_CODE="10017"
#USER_NAME="Jon Snow"

Usage

Printing today's weather forecast (to test the Weather.gov API):

python -m app.weather_service

# in production mode:
APP_ENV="production" COUNTRY_CODE="US" ZIP_CODE="20057" python -m app.weather_service

Sending an example email (to test the SendGrid service):

python -m app.email_service

NOTE: the SendGrid emails might first start showing up in spam, until you designate them as coming from a trusted source (i.e. "Looks Safe")

Sending the weather forecast in an email:

python -m app.daily_briefing

# in production mode:
APP_ENV="production" COUNTRY_CODE="US" ZIP_CODE="20057" python -m app.daily_briefing

Testing

Running tests:

pytest

# in CI mode:
CI=true pytest

Follow the deployment instructions to deploy the app to a remote server and schedule the server to send you the weather forecast email every day.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages