MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / fetch_captcha_challenge

Method fetch_captcha_challenge

app/services/payment_service.py:595–665  ·  view source on GitHub ↗
(
        self,
        account_id: str,
        *,
        analyze: bool = True,
        flow: FlowRun | None = None,
    )

Source from the content-addressed store, hash-verified

593 status="retry",
594 message="验证码 verify 返回 error=50,直接刷新重试",
595 details={"attempt": attempt, "error_code": error_code},
596 level=logging.WARNING,
597 )
598 self._push_runtime_message(
599 account_id,
600 f"验证码 verify 返回 error=50,第 {attempt} 轮重试中",
601 )
602 continue
603 if (error_code and error_code != "0") or not result["ticket"] or not result["randstr"]:
604 result["ticket"] = ""
605 result["randstr"] = ""
606 attempts.append(result)
607 last_result = result
608 self.runtime_logs.log_event(
609 flow,
610 stage="captcha_verify",
611 status="retry",
612 message="验证码 verify 未通过,刷新重试",
613 details={
614 "attempt": attempt,
615 "error_code": error_code,
616 "ticket_ready": bool(verify.get("ticket")),
617 "randstr_ready": bool(verify.get("randstr")),
618 },
619 level=logging.WARNING,
620 )
621 self._push_runtime_message(
622 account_id,
623 f"验证码 verify 未通过,第 {attempt} 轮重试中",
624 )
625 continue
626 attempts.append(result)
627 last_result = result
628 self.runtime_logs.log_event(
629 flow,
630 stage="captcha_attempt",
631 status="success",
632 message="验证码识别成功",
633 details={"attempt": attempt, "ticket_ready": True, "randstr_ready": True},
634 )
635 self._push_runtime_message(
636 account_id,
637 f"验证码识别成功,共尝试 {attempt} 轮",
638 )
639 solved = {
640 **result,
641 "attempts": attempts,
642 }
643 if own_flow:
644 self.runtime_logs.finish_run(
645 flow,
646 status="success",
647 message=f"验证码识别成功,共尝试 {attempt} 轮",
648 details={"attempts": attempt},
649 )
650 return solved
651 except Exception as exc:
652 if own_flow:

Callers 1

get_captcha_challengeFunction · 0.80

Calls 10

start_runMethod · 0.80
get_accountMethod · 0.80
prehandleMethod · 0.80
fetch_image_bytesMethod · 0.80
analyze_captcha_imageMethod · 0.80
load_sessionMethod · 0.80
save_sessionMethod · 0.80
log_eventMethod · 0.80
finish_runMethod · 0.80

Tested by

no test coverage detected