def __process_account(account, cfg): print "__processAccount(): ", account.getRef(), cfg # generate report item for later use reportItem = BingRewardsReportItem(account.getRef()) reportItem.accountType = account.accountType reportItem.accountLogin = account.accountLogin # generate headers for http requests (including spoofed agent string) httpHeaders = __generate_headers() # #$REFACTOR_HTTP$# #earn the rewards earnRewards(httpHeaders, reportItem, account.password, cfg) #if the earning was not successful, sleep and recurse if reportItem.error is not None: # we have to keep retry count; and other things, correct... print "__process_acount(): process failure, ", reportItem.retries, \ " attempts made" reportItem.retries += 1 reportItem.accountStatus = 1 else: reportItem.accountStatus = 0 return reportItem