bugs fixed.
parent
b2ead02346
commit
ad14b98fc7
|
@ -40,7 +40,10 @@ warnings.simplefilter('ignore',InsecureRequestWarning)
|
|||
|
||||
# ocr
|
||||
import base64
|
||||
import ddddocr
|
||||
try:
|
||||
import ddddocr
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
import ssl
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
|
@ -1640,11 +1643,9 @@ def tixcraft_manully_keyin_verify_code(driver, ocr_answer = ""):
|
|||
#PS: credit to LinShihJhang's share
|
||||
def tixcraft_auto_ocr(driver, ocr):
|
||||
print("start to ddddocr")
|
||||
orc_answer = None
|
||||
if not ocr is None:
|
||||
try:
|
||||
row_text = select_obj.first_selected_option.text
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
form_verifyCode_base64 = driver.execute_async_script("""
|
||||
var canvas = document.createElement('canvas');
|
||||
var context = canvas.getContext('2d');
|
||||
|
@ -1658,6 +1659,9 @@ def tixcraft_auto_ocr(driver, ocr):
|
|||
""")
|
||||
img_base64 = base64.b64decode(form_verifyCode_base64.split(',')[1])
|
||||
orc_answer = ocr.classification(img_base64)
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
if not orc_answer is None:
|
||||
print("orc_answer:", orc_answer)
|
||||
if len(orc_answer)==4:
|
||||
|
@ -1665,6 +1669,7 @@ def tixcraft_auto_ocr(driver, ocr):
|
|||
else:
|
||||
tixcraft_manully_keyin_verify_code(driver, "")
|
||||
|
||||
|
||||
def tixcraft_ticket_main(driver, config_dict, ocr):
|
||||
is_finish_checkbox_click = False
|
||||
auto_check_agree = config_dict["auto_check_agree"]
|
||||
|
@ -5123,7 +5128,11 @@ def main():
|
|||
if debugMode:
|
||||
print("Start to looping, detect browser url...")
|
||||
|
||||
ocr = None
|
||||
try:
|
||||
ocr = ddddocr.DdddOcr()
|
||||
except Exception as exc:
|
||||
pass
|
||||
|
||||
while True:
|
||||
time.sleep(0.1)
|
||||
|
|
Loading…
Reference in New Issue