"""临时验证:对比「扁平 body」与「{header,data} 信封 body」两种提交方式(用完即删)。""" import json import sys if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8", errors="replace") import tianque_login_test as m URL_NEW = "/management/easypay/api/user/transForm/login" URL_OLD = "/management/easypay/api/bankLogin/loginByAccount" def submit(session, url, wrapped, code, key): inner = { "loginAcc": m.ACCOUNT.strip(), "loginPwd": m.enc_password(m.PASSWORD.strip()), "imageCode": code, "imageKey": key, } payload = {"header": {"sysType": "pc"}, "data": inner} if wrapped else inner return m.post_json(session, url, payload) for url, wrapped in ((URL_NEW, True), (URL_NEW, False), (URL_OLD, True)): s = m.new_session() s.headers["omp_sui_pc"] = "pc" key, img = m.fetch_captcha(s) code = m.ocr_image(img) ok = m.ocr_code_ok(code) resp = submit(s, url, wrapped, code, key) print(f"\n[{url}] wrapped={wrapped} OCR={code!r} 格式OK={ok}") print(json.dumps(resp, ensure_ascii=False)[:400])