def oneVote(user,passw): '''Recontruit un urlOpener et Vote''' updateUrlOp() config = cfg.ProxyConfig() vote.config = config #reafectation pour thread try: vote.main(user, passw) except: pass else: config.writeTime(user=user) del (config)
def main(): if jsonparam['checkStatut']: ok = 0 try: ok = int(vote.urlOpener.open(jsonparam['checkUrl']+\ '?ver=%s'%(config.getVersionNbr())).read(50)) if not ok: vote.log.log('Erreur, le bot ne semble pas a jour.') sys.exit(0) except: pass global config try: os.chdir(os.path.dirname(sys.argv[0])) except: pass if not config.useProxy(): __login = config.getReadyacc() if __login and config.getLogin() == __login[0]: # Login != None et c'est le premier compte: __login = __login[0] if vote.main(__login['user'], __login['passw']) == 1: #vote success print 'vote success' config.writeTime(__login['user']) del(config) else: print 'proxy mode' del(config) proxyVote.main()
def main(): vote.ForceLogin=ForceLogin for acc in accs: print '''<p>--- Vote avec %s ---<br /> statut :''' % acc[0] try: vote.main(acc[0], acc[1]) except Exception, strerror: print strerror #finally: print '''<br /> --------------------- </p>''' vote.urlOpener = vote.urllib2.build_opener(\ vote.urllib2.HTTPCookieProcessor(vote.cookielib.CookieJar()))
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