Skip to content

Commit

Permalink
Create email_weekly.py
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlzhou committed May 7, 2023
1 parent 0196939 commit 47871db
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/email_weekly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
This script is a scheduled call to the remind web endpoint. That endpoint emails group heads who have had their group code used in the past 24 hours with a reminder email to check the dashboard. You can follow through the code in the admin blueprint.
This script should be scheduled daily.
"""

import os
import sys
import requests
from dotenv import load_dotenv

load_dotenv()
os.chdir(os.path.dirname(os.path.abspath(__file__)))


# TODO:
# 1) More secure storage of API key
# 2) Post URL's shouldn't be public

params = {'API_KEY': os.environ['API_KEY']}
if os.environ['FLASK_DEBUG'] == 'True':
requests.post('http://localhost:5000/api/remind/', params=params)
else:
requests.post('https://www.eabsentee.org/api/remind/', params=params)

0 comments on commit 47871db

Please sign in to comment.