Exemplo n.º 1
0
def main():
    print(datetime.now())

    # get new data from api
    new_update = parse_news_tags()
    # get last data from local cache data
    last_update = get_last_update()
    # write new data to local cache data
    write_last_update(new_update)

    if not last_update:
        print('initial')
        return

    # compare data
    keyset_new = set([_t[0] for _t in new_update])
    keyset_last = set([_t[0] for _t in last_update])
    keys_new = keyset_new - keyset_last

    # no update, return
    if not keys_new:
        print('no update')
        return

    # send notification!
    dict_new_update = dict(new_update)
    for kn in keys_new:
        print('update %s' % kn)
        nn = dict_new_update[kn]
        subject = 'UPDATE: Ontario Immigrant Nominee Program (%s)' % kn
        html = ''.join(nn)
        html = EMAIL_PREFIX + html
        send_msg(subject, html)
Exemplo n.º 2
0
def main():
    # Build subject
    date_monday = utils.get_next_monday()
    subject = "RHOS Weekly Team Status (%s)" %(date_monday.strftime('%a, %b %d'))

    # Import the managers message
    import msg_managers

    # Send the mail
    mail.send_msg (msg_managers, subject, send=False)
Exemplo n.º 3
0
def main():
    # Build subject
    date_monday = utils.get_next_friday()
    subject = "Weekly Status Reports (%s)" %(date_monday.strftime('%a, %b %d'))

    # Import the managers message
    import msg_my_staff

    # Send the mail
    mail.send_msg (msg_my_staff, subject, send=False)
Exemplo n.º 4
0
def func_mail():
    mail.send_msg()
    mail.receive_msg()
    mail.auto_send()