refactor: 移除reCAPTCHA任务的异常处理和超时逻辑以简化代码
This commit is contained in:
parent
7c645e93ca
commit
8470c1f21a
20
onoe.py
20
onoe.py
@ -262,7 +262,7 @@ def solve_recaptcha_v3_with_proxy(
|
|||||||
|
|
||||||
last_error = None
|
last_error = None
|
||||||
for attempt in range(1, max_task_retries + 1):
|
for attempt in range(1, max_task_retries + 1):
|
||||||
try:
|
# try:
|
||||||
encoded_query = quote(keyword, safe="")
|
encoded_query = quote(keyword, safe="")
|
||||||
payload = {
|
payload = {
|
||||||
"clientKey": "CAP-A76C932D4C6CCB3CA748F77FDC07D996",
|
"clientKey": "CAP-A76C932D4C6CCB3CA748F77FDC07D996",
|
||||||
@ -290,15 +290,15 @@ def solve_recaptcha_v3_with_proxy(
|
|||||||
return result["solution"]["token"]
|
return result["solution"]["token"]
|
||||||
time.sleep(polling_interval)
|
time.sleep(polling_interval)
|
||||||
|
|
||||||
raise TimeoutError(f"任务 {task_id} 在轮询 {max_poll_attempts} 次后未完成")
|
# raise TimeoutError(f"任务 {task_id} 在轮询 {max_poll_attempts} 次后未完成")
|
||||||
|
#
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
last_error = e
|
# last_error = e
|
||||||
if attempt < max_task_retries:
|
# if attempt < max_task_retries:
|
||||||
time.sleep(2)
|
# time.sleep(2)
|
||||||
continue
|
# continue
|
||||||
else:
|
# else:
|
||||||
break
|
# break
|
||||||
|
|
||||||
raise Exception(f"创建或获取 reCAPTCHA v3 token 失败: {last_error}")
|
raise Exception(f"创建或获取 reCAPTCHA v3 token 失败: {last_error}")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user