Пример #1
0
    def __init__(self):
        self.parser = HTML_parser.HTML_parser()
        self.bets_DB = BettingDB.BettingDB()
        self.emailer = Emailer.Emailer()
        self.games = {}
        self.date = datetime.datetime.now()

        random.seed(int(time.time()))
Пример #2
0
    def setup(self):
        #Load password from local file
        f = open('data.xtxt', 'r')
        lines = f.read().split('\n')
        for line in lines:
            for char in '\r\n':
                line.translate(None, char)

        self.emailer = Emailer.Emailer()
        self.emailer.setup(lines[0], lines[1])
Пример #3
0
    def __init__(self, league, sleep_time):
        self.league = league
        self.parser = HTML_Parser.HTML_Parser(self.league)
        self.bets_DB = BettingDB.BettingDB()
        self.emailer = Emailer.Emailer()
        self.games = {}
        self.date = datetime.datetime.now()
        self.sleep_time = sleep_time

        random.seed(int(time.time()))
Пример #4
0
    def run(self):
        #Load password from local file
        f = open('data.xtxt', 'r')
        lines = f.read().split('\n')
        for line in lines:
            for char in '\r\n':
                line.translate(None, char)

        emailer = Emailer()
        emailer.setup(lines[0], lines[1])
        emailer.send_command('buy', 'RVT 10')
Пример #5
0
def main():
    fieldConfigFile, config_inputdir, jobType = parse_opts()
    configItems = ConfigUtils.setConfigs(config_inputdir, fieldConfigFile)
    lg = pyLogger(configItems)
    logger = lg.setConfig()
    sc = SocrataClient(config_inputdir, configItems, logger)
    client = sc.connectToSocrata()
    clientItems = sc.connectToSocrataConfigItems()
    scrud = SocrataCRUD(client, clientItems, configItems, logger)
    sQobj = SocrataQueries(clientItems, configItems, logger)
    email_list = DatasetUtils.getDatasetAsDictListPageThrough(
        configItems['dd']['index']['fbf'], sQobj,
        configItems['dd']['index']['qryCols'])

    e = Emailer(configItems)
    ec = EmailComposer(configItems, e)
    base_email_txt = ec.getBaseMsgText('systems_updt')
    subject_line = e._emailConfigs['email_situations']['systems_updt'][
        'subject_line']
    wkbks_dir = configItems['wkbk_dir'] + '/blank_wkbks/'
    for item in email_list:
        msgBody = base_email_txt % (item['coordinator_name'],
                                    item['template_file_name'])
        attachment_dictList = [{
            item['template_file_name']:
            wkbks_dir + item['template_file_name']
        }, {
            'InventoryUpdateGuidance.pdf':
            wkbks_dir + 'InventoryUpdateGuidance.pdf'
        }]
        recipientsActual = {
            'To': item['primary_data_coordinator'],
            'bcc': '*****@*****.**'
        }
        if 'secondary_data_coordinator' in item.keys():
            recipientsActual['cc'] = item['secondary_data_coordinator']
        print recipientsActual
        #recipientsFake =  { 'To': '*****@*****.**', 'cc':'*****@*****.**', 'bcc': '*****@*****.**'}
        mail_recipient = e.sendEmails(subject_line,
                                      msgBody,
                                      fname_attachment=None,
                                      fname_attachment_fullpath=None,
                                      recipients=recipientsActual,
                                      attachment_dictList=attachment_dictList,
                                      isETL=False)
Пример #6
0
    def generateEmailMsg(configItems, activity, email_content):
        notification_datsetids = []
        msg_body = configItems['email_msg_template']['header'] + configItems[
            'activity'][activity]['email_msg']['msg_header']
        attachment_list = []
        for content in email_content['content']:
            msg_body = msg_body + "<p>" + content['report_html'] + "</p>"
            notification_datsetids = notification_datsetids + content[
                'datasetids']

        subject_line = configItems['activity'][activity]['email_msg'][
            'subject_line'] + ": " + str(
                email_content['number_of_actions']) + " " + configItems[
                    'activity'][activity]['email_msg']['subject_line_action']
        msg_body = msg_body + configItems['email_msg_template']['footer']
        em = Emailer(configItems)
        em.sendEmails(subject_line,
                      msg_body.encode('utf-8').strip(),
                      fname_attachment=email_content['report_attachment_name'],
                      fname_attachment_fullpath=email_content[
                          'report_attachment_fullpath'])
        return notification_datsetids
 def sendJobStatusEmail(self, finishedDataSets):
     msgBody  = ""
     for i in range(len(finishedDataSets)):
         #remove the column definitions, check if records where inserted
         dataset = self.sucessStatus( DictUtils.removeKeys(finishedDataSets[i], self.keysToRemove))
         msg = self.makeJobStatusMsg( finishedDataSets[i]  )
         msgBody  = msgBody  + msg
     subject_line = self.getJobStatus()
     email_attachment = self.makeJobStatusAttachment(finishedDataSets)
     e = Emailer(self.configItems)
     emailconfigs = e.setConfigs()
     if os.path.isfile(self.logfile_fullpath):
         e.sendEmails( subject_line, msgBody, self.logfile_fname, self.logfile_fullpath)
     else:
         e.sendEmails( subject_line, msgBody)
     print "****************JOB STATUS******************"
     print subject_line
     print "Email Sent!"
     self._logger.info("****************JOB STATUS******************")
     self._logger.info( subject_line)
     self._logger.info("Email Sent!")
     self._logger.info("****************JOB END******************")