コード例 #1
0
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
    results = dataMonitor.getAllHeartBeatTime(cursor_out=None)
    print 'check....'
    needSendTypes = []
    currTimeStr = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
    print 'now: ', currTimeStr
    for result in results:
        (type, update_time) = result
        timeArray = time.strptime(str(update_time), "%Y-%m-%d %H:%M:%S")
        update_time_long = int(time.mktime(timeArray))
        print 'that: ', update_time
        if outOfData(update_time_long):
            print 'outOfData--------', type, update_time
            needSendTypes.append((type, update_time))

    if len(needSendTypes) and checkNeedSend():
        print '-------need send email---------'
        randomStr = str(random.uniform(0, 1))
        ret = mail(randomStr + ':' + ','.join(needSendTypes))
        for type, update_time in needSendTypes:
            print type, update_time
        if ret:
            print 'send_success'
            global lastSendTime
            lastSendTime = int(time.time())
コード例 #2
0
 def __init__(self, name=None, **kwargs):
     super(WXSourceSpider, self).__init__(name=None, **kwargs)
     self.count = 0
     self.wxSourceDao = WxSourceDao()
     self.currIp = ''
     self.logDao = LogDao(self.logger, 'weixin_source_catch')
     self.dataMonitor = DataMonitorDao()
コード例 #3
0
ファイル: SinaSpider2.py プロジェクト: MaGuiSen/studyScrapy
 def __init__(self, name=None, **kwargs):
     super(SinaSpider, self).__init__(name=None, **kwargs)
     self.count = 0
     self.logDao = LogDao(self.logger, 'sina_detail')
     self.checkDao = CheckDao()
     # 用于缓存css
     self.css = {'hash': 'style'}
     self.dataMonitor = DataMonitorDao()
コード例 #4
0
 def __init__(self, name=None, **kwargs):
     super(WXDetailSpider, self).__init__(name=None, **kwargs)
     self.count = 0
     self.wxSourceDao = WxSourceDao()
     self.logDao = LogDao(self.logger, 'weixin_list_detail')
     self.checkDao = CheckDao()
     self.dataMonitor = DataMonitorDao()
     self.wxSources = []
     self.brokenAccounts = []  # 当前被禁止了的账号,下次抓取优先抓取
コード例 #5
0
 def __init__(self, name=None, **kwargs):
     super(WYDetailSpider, self).__init__(name=None, **kwargs)
     self.count = 0
     self.request_stop = False
     self.request_stop_time = 0
     self.logDao = LogDao(self.logger, 'wangyi_list_detail')
     self.checkDao = CheckDao()
     # 用于缓存css
     self.css = {'hash': 'style'}
     self.dataMonitor = DataMonitorDao()
コード例 #6
0
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
    dataMonitor.heartBeat('weixin_heartbeat')
コード例 #7
0
ファイル: TimerCrawl.py プロジェクト: MaGuiSen/studyScrapy
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
コード例 #8
0
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
    dataMonitor.heartBeat('wangyi_heartbeat')
コード例 #9
0
ファイル: TimerCrawl.py プロジェクト: BTYT/studyScrapy
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
    dataMonitor.heartBeat('tengxun_heartbeat')
コード例 #10
0
def heartBeat():
    # 心跳
    dataMonitor = DataMonitorDao()
    dataMonitor.heartBeat('sina_heartbeat')