コード例 #1
0
ファイル: msnsend.py プロジェクト: waitingzeng/ttwait
    def work(self, name, id=0):
        try:
            line = self.accounts.get_rnd()
            if line.find('----') != -1:
                account, psw = line.split('----', 1)
            else:
                account = line.split('\t')[0]
                psw = '846266'
        except NotDataException:
            mysignal.ALIVE = False
            return

        self.msn_ct += 1
        msn_ct = self.msn_ct
        #self.log.error('%d %s begin connect' % (msn_ct, account))
        app = MSN()
        T = DiffTime()
        try:
            res = app.connect(account, psw)
        except TimeoutException:
            self.log.error("$d %s login timeout usetime %s", msn_ct, account, T.get_diff())
            return
        if not res:
            self.log.error('%d %s %s login fail, usetime %s' % (msn_ct, account, psw, T.get_diff()))
            self.accounts.set_fail(line)
            return
        else:
            self.log.error('%d %s login success usetime %s' % (msn_ct, account, T.get_diff()))
        try:
            self.send_members_oim(app, account, psw, msn_ct, self.msgs, T)
        except:
            self.log.exception('%s %s send fail', account, psw)
            pass
        app.disconnect()