unemployment-inclass-2022

Setup

Create and activate a virtual environment:

conda create -n unemployment-env python=3.8

conda activate unemployment-env

Install package dependencies:

pip install -r requirements.txt

Configuration

Obtain an API Key from AlphaVantage (i.e. ALPHAVANTAGE_API_KEY).

Also sign up for the SendGrid Service, verify your single sender address (i.e. SENDER_EMAIL_ADDRESS), and obtain an API Key (i.e. SENDGRID_API_KEY). See these setup notes for more details.

Then create a local ".env" file and provide the keys like this:

# this is the ".env" file...

ALPHAVANTAGE_API_KEY="_________"
SENDER_EMAIL_ADDRESS="you@example.com"
SENDGRID_API_KEY="__________"

Usage

Run an example script:

python app/my_script.py

Run the unemployment report:

python -m app.unemployment

Run stocks report:

python -m app.stocks

Web App

Run the web app (then view in the browser at http://localhost:5000/):

# Mac OS:
FLASK_APP=web_app flask run

# Windows OS:
# ... if `export` doesn't work for you, try `set` instead
# ... or set FLASK_APP variable via ".env" file
export FLASK_APP=web_app
flask run

Email Sending

Run the email service to send an example email and see if everything is working:

python -m app.email_service

Send the unemployment report via email:

python -m app.unemployment_email

Send the stocks report via email:

python -m app.stocks_email

# or in production mode:
APP_ENV="production" DEFAULT_SYMBOL="GOOGL" python -m app.stocks_email

Testing

Run tests:

pytest