#!/usr/bin/env python3 # -*- coding: utf-8 -*- """순차 DRF 조회 — 말소등기토지의일부만에관하여말소등기청구 v2 검증용.""" import os, subprocess, sys, time OUT = "/Users/allen_jhang/Library/CloudStorage/Dropbox/Business/Eroom AI Partners/Legal POC portfolio/민사에이전트-사해행위취소및대여금청구/POC - Law-aid Agent/프롬프트/prompt_updates_sequential/Default_Agent_청구취지기재방법/tmp/drf_토지일부말소_v2" os.makedirs(OUT, exist_ok=True) JOBS = [ # (파일명, URL, 쿼리파라미터 리스트) ("law_search_minbeop.xml", "http://www.law.go.kr/DRF/lawSearch.do", ["OC=test", "target=law", "query=민법", "type=XML", "display=20"]), ("law_minbeop.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=law", "MST=284415", "type=XML"]), ("law_gonggan.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=law", "MST=284007", "type=XML"]), ("law_dosan.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=law", "MST=267359", "type=XML"]), ("admrul_1786.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=admrul", "ID=2200000106023", "type=XML"]), ("admrul_122.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=admrul", "ID=2200000091531", "type=XML"]), ("prec_103652.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=prec", "ID=103652", "type=XML"]), ("prec_191635.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=prec", "ID=191635", "type=XML"]), ("prec_163722.xml", "http://www.law.go.kr/DRF/lawService.do", ["OC=test", "target=prec", "ID=163722", "type=XML"]), ("law_search_budeung.xml", "http://www.law.go.kr/DRF/lawSearch.do", ["OC=test", "target=law", "query=부동산등기법", "type=XML", "display=20"]), ] # 링크 실측(HTML title만) LINKCHECK = [ ("link_001706.txt", "https://www.law.go.kr/lsInfoP.do?lsiSeq=001706"), ("link_284415.txt", "https://www.law.go.kr/lsInfoP.do?lsiSeq=284415"), ("link_265377.txt", "https://www.law.go.kr/lsInfoP.do?lsiSeq=265377"), ] def fetch(path, url, params=None): cmd = ["curl", "-sS", "--http1.1", "-A", "Mozilla/5.0", "--max-time", "90"] if params: cmd.append("-G") for p in params: cmd += ["--data-urlencode", p] cmd += [url, "-o", path] for i, delay in enumerate([0, 12, 24]): if delay: time.sleep(delay) r = subprocess.run(cmd, capture_output=True, text=True) if r.returncode == 0 and os.path.exists(path) and os.path.getsize(path) > 200: return True, os.path.getsize(path) return False, 0 # 충돌 완화 대기 time.sleep(24) for name, url, params in JOBS: ok, size = fetch(os.path.join(OUT, name), url, params) print(f"{name}\t{'OK' if ok else 'FAIL'}\t{size}", flush=True) time.sleep(8) for name, url in LINKCHECK: ok, size = fetch(os.path.join(OUT, name), url, None) print(f"{name}\t{'OK' if ok else 'FAIL'}\t{size}", flush=True) time.sleep(8) print("DONE", flush=True)