def _login(self, auth_provider, position):
self.log.info('Attempting login: {}'.format(auth_provider.username))
consecutive_fails = 0
while not auth_provider.user_login():
sleep_t = min(math.exp(consecutive_fails / 1.7), 5 * 60)
self.log.info('Login failed, retrying in {:.2f} seconds'.format(sleep_t))
consecutive_fails += 1
time.sleep(sleep_t)
if consecutive_fails == 5:
raise AuthException('Login failed five times.')
self.log.info('Login successful: {}'.format(auth_provider.username))
评论列表
文章目录