def voteall(): global config accs = config.getReadyacc() del (config) print len(accs) for accinfo in accs: print accinfo['user'] timeout(oneVote, kwargs=accinfo, timeout_duration=100)
def voteall(): # ------------------- def oneVote(user, passw): ret = None configT = cfg.ProxyConfig() vote.config = configT try: print getMyIp(vote.urlOpener) print "vote start" ret = vote.main(user, passw) print "vote end" except Exception as inst: print "e", inst return inst configT.writeTime(user=user) return ret # ------------------- print len(config.getReadyacc()) for accinfo in config.getReadyacc(): print accinfo["user"] time_out = 5 # 5 chance while time_out: print time_out try: updateUrlOp(proxys()) res = timeout(oneVote, kwargs=accinfo, timeout_duration=100) if res == 1: time_out = 0 print "ok" elif str(res).find("Proxy") != -1: import LogIt log = LogIt.logit() log.log("Ce proxy semble ne semble pas fonctionel : %s" % (proxys.getCurrentProxy())) raise (Exception("erreur proxy")) else: raise (Exception(str(res))) except: print "erreur" time_out -= 1