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