本文整理汇总了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)