move code from block 1 to block 2.
parent
c94e31f826
commit
a11c660d20
|
@ -1837,12 +1837,6 @@ def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, C
|
||||||
orc_answer = ocr.classification(img_base64)
|
orc_answer = ocr.classification(img_base64)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
if previous_answer is None:
|
|
||||||
# page is not ready, retry again.
|
|
||||||
# PS: usually occur in async script get captcha image.
|
|
||||||
is_need_redo_ocr = True
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
ocr_done_time = time.time()
|
ocr_done_time = time.time()
|
||||||
ocr_elapsed_time = ocr_done_time - ocr_start_time
|
ocr_elapsed_time = ocr_done_time - ocr_start_time
|
||||||
|
@ -1863,7 +1857,7 @@ def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, C
|
||||||
is_need_redo_ocr = True
|
is_need_redo_ocr = True
|
||||||
if previous_answer != orc_answer:
|
if previous_answer != orc_answer:
|
||||||
previous_answer = orc_answer
|
previous_answer = orc_answer
|
||||||
print("click captcha again")
|
print("click captcha again.")
|
||||||
if True:
|
if True:
|
||||||
# selenium solution.
|
# selenium solution.
|
||||||
tixcraft_reload_captcha(driver, domain_name)
|
tixcraft_reload_captcha(driver, domain_name)
|
||||||
|
@ -1879,12 +1873,12 @@ def tixcraft_auto_ocr(driver, ocr, away_from_keyboard_enable, previous_answer, C
|
||||||
else:
|
else:
|
||||||
print("orc_answer is None")
|
print("orc_answer is None")
|
||||||
print("previous_answer:", previous_answer)
|
print("previous_answer:", previous_answer)
|
||||||
|
# page is not ready, retry again.
|
||||||
|
# PS: usually occur in async script get captcha image.
|
||||||
|
is_need_redo_ocr = True
|
||||||
if previous_answer is None:
|
if previous_answer is None:
|
||||||
tixcraft_keyin_captcha_code(driver)
|
tixcraft_keyin_captcha_code(driver)
|
||||||
else:
|
time.sleep(0.1)
|
||||||
# page is not ready, retry again.
|
|
||||||
# PS: usually occur in async script get captcha image.
|
|
||||||
is_need_redo_ocr = True
|
|
||||||
|
|
||||||
return is_need_redo_ocr, previous_answer, is_form_sumbited
|
return is_need_redo_ocr, previous_answer, is_form_sumbited
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue