feat(realestate): 내부 인증 + naver 워커 targets 엔드포인트 + nginx internal 블록

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EqCYBhvTcdeCTUDX3RhWx9
This commit is contained in:
2026-07-10 00:27:23 +09:00
parent 008111eff8
commit f931c496d8
5 changed files with 85 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
"""naver-fetch 워커 내부 계약: targets 조회 + listings ingest."""
import os
import logging
from fastapi import APIRouter, Depends
from .auth import verify_internal_key
from .db import get_listing_criteria
from .lawd_codes import naver_cortar
logger = logging.getLogger("realestate-lab")
router = APIRouter()
NAVER_PAGE_LIMIT = int(os.getenv("NAVER_PAGE_LIMIT", "2"))
@router.get("/api/internal/realestate/targets", dependencies=[Depends(verify_internal_key)])
def listing_targets():
crit = get_listing_criteria()
dongs = []
for d in crit.get("dongs", []):
code = naver_cortar(d)
if not code:
logger.warning("naver cortarNo 매핑 없음 — 대상 제외: %s", d)
continue
dongs.append({"dong": d, "cortar_no": code})
return {"dongs": dongs, "deal_types": crit.get("deal_types", []),
"page_limit": NAVER_PAGE_LIMIT}