Пример #1
0
def fill():
    data = pd.read_excel(config.emails_xls).fillna("")

    for person in data.iterrows():
        person = person[1]
    
        HR = le(person['HR']) if len(person['HR']) else ''
        LL = le(person['LL']) if len(person['LL']) else ''
    
        attributes = {'first_name' : person['first_name'],
                      'last_name'  : person['last_name'],
                      'HR'         : Json(HR),
                      'LL'         : Json(LL),
                      'email'      : person['email'],
                      'area_code'  : person['area_code'],
                      'phone'      : person['phone'],
                      'optin'      : bool(person['optin'])}
        
        dbc.query(config.FILL,attributes) #This is bad, should use psycopg2.cursor.executemany for table filling
Пример #2
0
def main():
    log.info("PROGRAM START")
    
    day  = config.day_to_abv[datetime.date.today().weekday()]
    time = datetime.datetime.now().hour + 1
        
    event = { 'day'  : str(day),
              'time' : str(time) }

    log.debug("Ask database for HR for day: %(day)s and time %(time)s" % event)
    event['loc'] = 'hr'
    HR = dbc.query(config.QUERY(event))

    log.debug("Ask database for LL for day: %(day)s and time %(time)s" % event)
    event['loc'] = 'll'
    LL = dbc.query(config.QUERY(event))

    if HR is not None:
        sm.send_mail(HR,"Help Room")
    if LL is not None:
        sm.send_mail(LL,"Lab Library")

    log.info("PROGRAM END")
    sys.exit(0)
Пример #3
0
def create():
    dbc.query(config.CREATE_TABLE)
Пример #4
0
#!/usr/bin/python

import config
from reminders import dbc
import datetime

day  = datetime.date.today().weekday()
time = datetime.datetime.now().hour + 1

event = { 'day'  : str(config.day_to_abv[day]),
          'time' : str(time) }

event['loc'] = 'hr'
HR = dbc.query(config.QUERY(event))

event['loc'] = 'll'
LL = dbc.query(config.QUERY(event))

print HR
print LL
Пример #5
0
def drop():
    dbc.query(config.DROP_TABLE)