修复重试
This commit is contained in:
@@ -19,7 +19,7 @@ from fake_useragent import UserAgent # 导入 UserAgent
|
||||
from loguru import logger
|
||||
from playwright._impl._page import Page
|
||||
from playwright.sync_api import sync_playwright, Error, TimeoutError
|
||||
from tenacity import retry
|
||||
from tenacity import retry, stop_after_attempt, wait_fixed, retry_if_exception_type
|
||||
|
||||
import const
|
||||
from const import BUCKET, BASE_PATH
|
||||
@@ -917,7 +917,11 @@ def is_timeout_error(exception):
|
||||
return isinstance(exception, TimeoutError)
|
||||
|
||||
|
||||
@retry(stop_max_attempt_number=3, wait_fixed=2000, retry_on_exception=is_timeout_error)
|
||||
@retry(
|
||||
stop=stop_after_attempt(3),
|
||||
wait=wait_fixed(2),
|
||||
retry=retry_if_exception_type(TimeoutError)
|
||||
)
|
||||
def playwright_m_login(username, password, code_2fa=None):
|
||||
logger.info(f"登录账号{username}")
|
||||
# 检查是否冻结
|
||||
|
||||
Reference in New Issue
Block a user