本文整理匯總了Python中eventsProcessor.EventsProcessor.onScriptComplete方法的典型用法代碼示例。如果您正苦於以下問題:Python EventsProcessor.onScriptComplete方法的具體用法?Python EventsProcessor.onScriptComplete怎麽用?Python EventsProcessor.onScriptComplete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eventsProcessor.EventsProcessor
的用法示例。
在下文中一共展示了EventsProcessor.onScriptComplete方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __run
# 需要導入模塊: from eventsProcessor import EventsProcessor [as 別名]
# 或者: from eventsProcessor.EventsProcessor import onScriptComplete [as 別名]
def __run(config):
report = list()
doSleep = False
for key, account in config.accounts.iteritems():
if account.disabled:
continue
# sleep between two accounts logins
if doSleep:
extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt)
if verbose:
print("\nPausing between accounts for {0} seconds".format(int(extra)))
time.sleep(extra)
reportItem = BingRewardsReportItem()
reportItem.accountType = account.accountType
reportItem.accountLogin = account.accountLogin
agents = bingCommon.UserAgents.generate(account)
httpHeaders = bingCommon.HEADERS
httpHeaders["User-Agent"] = agents.pc
__processAccount(config, httpHeaders, agents, reportItem, account.password)
report.append(reportItem)
doSleep = True
#
# trigger full report if needed
#
if showFullReport or totalPoints > 0 and len(report) > 1:
print
print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= FINAL REPORT =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
print
print " Account | Before | After | Earned | Lifetime | Retries "
print "------------------------------+--------+--------+--------+------------+---------"
for r in report:
print " %-28s | %6d | %6d | %6d | %10d | %7d" % (__stringifyAccount(r, 28), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.lifetimeCredits, r.retries)
print
#
# print footer
#
print "Total points earned: %d" % totalPoints
print
print "%s - script ended" % helpers.getLoggingTime()
EventsProcessor.onScriptComplete(config)
示例2: __run
# 需要導入模塊: from eventsProcessor import EventsProcessor [as 別名]
# 或者: from eventsProcessor.EventsProcessor import onScriptComplete [as 別名]
def __run(config):
report = list()
accountIndex = 0
for key, account in config.accounts.iteritems():
if account.disabled:
continue
# sleep between two accounts logins
if accountIndex > 0:
isFirstAccount = False
extra = config.general.betweenAccountsInterval + random.uniform(0, config.general.betweenAccountsSalt)
time.sleep(extra)
reportItem = BingRewardsReportItem()
reportItem.accountType = account.accountType
reportItem.accountLogin = account.accountLogin
__processAccount(config, reportItem, account.password)
report.append(reportItem)
accountIndex += 1
EventsProcessor.onScriptComplete(config)
#
# trigger full report if needed
#
if showFullReport or totalPoints > 0 and len(report) > 1:
print
print " -=-=-=-=-=-=-=-=-=-=--=-=- FULL REPORT -=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-="
print
print " Account | Before | After | Earned | Retries | Lifetime Credits"
print "---------------------------+--------+--------+--------+---------+-----------------"
for r in report:
print " %25s | %6d | %6d | %6d | %7d | %16d" % (__stringifyAccount(r, 25), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.retries, r.lifetimeCredits)
print
#
# print footer
#
print "Total points earned: %d" % totalPoints
print
print "%s - script ended" % helpers.getLoggingTime()
示例3: __run
# 需要導入模塊: from eventsProcessor import EventsProcessor [as 別名]
# 或者: from eventsProcessor.EventsProcessor import onScriptComplete [as 別名]
def __run(config):
report = list()
doSleep = False
#for key, account in config.accounts.iteritems():
for key, account in config.accounts.items():
if account.disabled:
continue
reportItem = __processAccountUserAgent(config, account, bingCommon.USER_AGENTS_PC, doSleep)
report.append(reportItem)
doSleep = True
#
# trigger full report if needed
#
if (showFullReport or totalPoints > 0 and len(report) > 1):
print
print (" -=-=-=-=-=-=-=-=-=-=--=-=- FULL REPORT -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-")
print
print (" Account | Before | After | Earned | Retries | Lifetime Credits")
print ("---------------------------+--------+--------+--------+---------+-----------------")
for r in report:
print (" %25s | %6d | %6d | %6d | %7d | %16d" % (__stringifyAccount(r, 25), r.oldPoints, r.newPoints, r.pointsEarnedRetrying, r.retries, r.lifetimeCredits))
print
#
# print footer
#
print ("Total points earned: %d" % totalPoints)
print
print ("%s - script ended" % helpers.getLoggingTime())
EventsProcessor.onScriptComplete(config)