class Application(ThreadBase): def init(self): self.pjs = self.conf.pjs #open_debug() self.client = MagicClient(self.conf.account_server[0], int(self.conf.account_server[1])) self.next = self._next() def _next(self): while True: try: ret = self.client.get_new_account() except: log.exception("get_new_account fail") time.sleep(5) continue if not ret: time.sleep(5) continue break yield ret def work_py(self, name, id=0): with self.lock: try: email = self.next.next() except StopIteration: raise WorkerFinishException app = OutLook(email, '846266') try: res = app.login() if res: app.into_profile() #app = OutLook(email, '846266') #app.login() #if app.proof(): log.trace('%s active success', email) self.client.add_account(email, 1) except ProofException: log.trace('%s active success', email) self.client.add_account(email, 1) except: time.sleep(2) def work_js(self, name, id=0): with self.lock: try: email = self.next.next() except StopIteration: raise WorkerFinishException cmd = '%s active.js %s' % (self.pjs, email) res = os.system(cmd) res = res / 256 log.trace('%s active %s %s', name, email, res) res = int(res) try: if res == 0: self.client.add_account(email, 1) elif res == 2: self.client.add_account(email, -1) except: time.sleep(2) #time.sleep(2) work = work_js