Пример #1
0
 def callback(message):
     m = Mail()
     q = BigQ()
     m.populateSnippet()
     for i in m.data:
         q.insert(i[0], i[1], i[2], i[4])
     print("Received message: {}".format(message))
     message.ack()
Пример #2
0
def cleanUpEmails():
    q = BigQ()
    q.deleteMsgDays('%Hope you are doing well%')
    q.deleteMsgDays('%Test msg delete*%')
    q.delete100dayOld()
    # Sunday update ignore domains
    if datetime.today().weekday() == 6:
        q.addDomainsToIgnore()
Пример #3
0
 def test_DeleteMsg(self):
     m = Mail()
     service = m.getService()
     message = m.create_message('*****@*****.**', '*****@*****.**',
                                'Test Msg -', 'Test msg delete*')
     m.populateSnippet()
     sleep(1)
     b = BigQ()
     result = b.deleteMsgDays('%Test msg delete%', -2)
     self.assertEqual(result.state, 'DONE')
Пример #4
0
 def queryParsedEMLnoTXT(self, limit=1):
     b = BigQ()
     query = """
     SELECT subject,msg,timeStamp,returnpath FROM `septapig.mail.parsed` 
     where subject like '%C2C Contracts Only.%'
     and timeStamp > (select max(timestamp) from `septapig.mail.analysis`)
     order by timeStamp desc
     LIMIT {}
            """.format(limit)
     return b.select(query)
Пример #5
0
 def updateAnalysisTable(self, stored_file):
     b = BigQ()
     query = """
     insert into `septapig.mail.analysis` (txt,subject,msg,timeStamp,
     returnpath,stored_file)
       SELECT txt,subject,msg,timeStamp,returnpath,'{}' FROM 
       `septapig.mail.parsed` 
       where subject like '%C2C Contracts Only.%'
     and timeStamp > (select max(timeStamp) from `septapig.mail.analysis`)
     """.format(stored_file)
     query_job = b.select(query)
     [x for x in query_job]
     return query_job
Пример #6
0
def UpdateTableParsed():
    b = BigQ()
    # b.select('drop table IF EXISTS `septapig.mail.tmp0`')

    d = b.d()
    p = Parse(d)
    p.raw().subject().date().received().save()
    query = """
            insert into  `septapig.mail.parsed` 
    SELECT b.* FROM `septapig.mail.parsed` a
    right outer join `septapig.mail.tmp0` b
    on a.id = b.id
    where a.id is null
            """
    result = b.select(query)
    [x for x in result]
Пример #7
0
    def queryParsedEML(self, limit=1):
        b = BigQ()
        query = """
SELECT a.txt,a.subject,a.msg,a.timeStamp,a.returnpath,
REPLACE(REPLACE(SUBSTR(a.returnpath,STRPOS(a.returnpath,'@'),390),">",""),
"<","") as domain
FROM `septapig.mail.parsed` a left outer join `septapig.mail.noC2C` b
on REPLACE(REPLACE(SUBSTR(a.returnpath,STRPOS(a.returnpath,'@'),390),">",""),
"<","") = b.domain
where a.subject like '%C2C Contracts Only.%'
and b.domain is null
and timeStamp > (select max(timeStamp) from `septapig.mail.analysis`)
LIMIT {}

               """.format(limit)
        return b.select(query)
Пример #8
0
    def test_FBMail(self):
        b = BigQ()
        query = """
        
        SELECT a.* FROM 
            `septapig.mail.response` a left outer join   
            `septapig.mail.reject_response` b
        on a.returnpath=b.returnpath and a.timeStamp = b.timeStamp
        where b.returnpath is null
        order by timeStamp desc
        LIMIT 20
 
                """
        result = b.select(query)
        fbmail = FBmail()
        count = 0
        for row in result:
            fbmail.update(count, row['subject'], row['returnpath'], row['msg'],
                          row['timeStamp'])
            print(row['subject'])
            count += 1
Пример #9
0
 def test_rejectDomains(self):
     b = BigQ()
     domains = b.rejectDomains()
     self.assertGreater(len(domains), 2)
Пример #10
0
 def test_DeleteBounce(self):
     b = BigQ()
     print(b.deleteBounce())
Пример #11
0
 def test_filter(self):
     b = BigQ()
Пример #12
0
def insertTableMC():
    m = Mail()
    q = BigQ()
    m.populateSnippet()
    for i in m.data:
        q.insert(i[0], i[1], i[2], i[4], i[5])
Пример #13
0
 def test_Delete_msg(self):
     q = BigQ()
     q.deleteMsg('%Hope you are doing well%')
     q.deleteMsg('%Test msg delete*%')
Пример #14
0
 def test_Mail(self):
     m = Mail()
     q = BigQ()
     m.populateSnippet()
     for i in m.data:
         q.insert(i[0], i[1], i[2], i[4], i[5])
Пример #15
0
 def tearDownClass(cls) -> None:
     q = BigQ()
     q.deleteMsg('%Test msg delete%')
Пример #16
0
 def test_BigQ(self):
     b = BigQ()
     print(b.getTime())