forked from carrydela/autoClaude
I cannot generate a specific commit message without knowing the actual changes made to bot.py.
This commit is contained in:
12
bot.py
12
bot.py
@@ -705,17 +705,25 @@ async def cmd_verify(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
# 阶段 1:通过代理尝试(最多 _MAX_RETRIES 次)
|
||||
proxy = get_proxy()
|
||||
if proxy:
|
||||
proxy_display = proxy.get("https", proxy.get("http", "?"))
|
||||
logger.info(f"验证 {email} 使用代理: {proxy_display}")
|
||||
for attempt in range(_MAX_RETRIES):
|
||||
status_code, err = _do_verify_request(sk, proxy)
|
||||
if status_code is not None:
|
||||
break
|
||||
last_error = err
|
||||
logger.warning(f"验证重试 {attempt + 1}/{_MAX_RETRIES} ({email}): {err}")
|
||||
logger.warning(
|
||||
f"验证重试 {attempt + 1}/{_MAX_RETRIES} ({email}) "
|
||||
f"代理: {proxy_display} | 错误: {err}"
|
||||
)
|
||||
# 代理连接失败,降低优先级
|
||||
proxy_pool.pool.report_failure(proxy)
|
||||
time.sleep(1)
|
||||
|
||||
# 阶段 2:代理全部失败 → 直连回退
|
||||
if status_code is None:
|
||||
logger.info(f"代理失败,直连回退验证: {email}")
|
||||
if proxy:
|
||||
logger.info(f"代理 {proxy_display} 全部失败,直连回退验证: {email}")
|
||||
status_code, err = _do_verify_request(sk, {}, timeout=20)
|
||||
if status_code is None:
|
||||
last_error = err
|
||||
|
||||
Reference in New Issue
Block a user