Exemplo n.º 1
0
from sms import SmsEngine
from grades import GradeSummary
from assignments import Assignment

logging.basicConfig(level=logging.INFO)

connInfo = {
    "dbname": os.getenv('DBNAME', "echoalert"),
    "user": os.getenv('DBUSER', "postgres"),
    "host": os.getenv('DBHOST', "localhost"),
    "port": os.getenv('DBPORT', "5432"),
    "password": os.getenv('DBPASS', "defaultpassword"),
}

PgDb.setup(**connInfo)
notifications = Notifier.get_new_notices()

sid = os.getenv("TWILIO_SID", "")
token = os.getenv("TWILIO_TOKEN", "")
sms_from = os.getenv("TWILIO_FROM", "")

logging.info("Checking for any pending notifications")
logging.info("twilio sid={}, token={}".format(sid, token))

sms = SmsEngine(sid, token, sms_from)

skip = []
for ndata in notifications:

    notify_type = ndata['notification_type']
    if notify_type not in skip: