AutoRpa/rpa_rebate/run_find.py

26 lines
841 B
Python

"""页面查号入口。不连 Oracle、不录协议。验收只看 ACCEPT.txt。"""
from __future__ import annotations
import os
from apa_browser_adapter import ApaBrowserAdapter
from db import load_runtime_env
from rebate_finder import context_from_env
from rebate_flow_steps import SENTINEL_CONTRACT_NO, run_find_flow
def main() -> int:
load_runtime_env()
contract_no = (os.getenv("REBATE_ACCEPT_CONTRACT_NO") or SENTINEL_CONTRACT_NO).strip()
expect_found = None if contract_no != SENTINEL_CONTRACT_NO else False
ctx = context_from_env()
browser = ApaBrowserAdapter(url=ctx.rebate_url, flow="REBATE_FIND")
found = run_find_flow(browser, ctx, contract_no, expect_found=expect_found)
if expect_found is False and found:
return 1
return 0
if __name__ == "__main__":
raise SystemExit(main())