feat(lps): 봇 감지 시 IP 회전+재시도 + 감지 이력 기록
쿠팡이 봇으로 감지(Akamai 차단 페이지)하면, 같은 IP로 재시도하던 것을 '브라우저 끄고 새 IP로 켜서 재시도'로 전환. 감지 패턴도 축적한다. - DecodoProxy.rotate(): 시간창 무관 즉시 다음 포트(=새 IP). current_port 노출 - coupang/adapter: 0건+차단마커 감지 시 → 감지기록 → proxy.rotate()+강제재기동 → 인라인 재시도(max_block_retries=1). IP당 요청수(ip_request_no) 추적, 재기동 시 리셋 - bot_detection 테이블 + crud: source/query/ip_request_no/proxy_port/elapsed_sec/marker/ headless/html_len 기록 → 'IP당 몇 요청 만에 감지되나' 분석 가능 - worker_main: on_detect=BotDetectionLog.record 주입 - 로그: [coupang][BOT-DETECTED] ip_req#N port=... elapsed=...s marker=... - tests: proxy rotate 즉시회전 + 감지기록 CRUD → 전체 47/47 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7911ba1745
commit
bca8032b79
7 files changed
+176
-29
No files matched your search
@@ -39,3 +39,14 @@ def test_port_selected_within_range_and_stable_in_window():
|
||||
def test_single_port_range():
|
||||
p = _p(port_start=10001, port_end=10001)
|
||||
assert p._port() == 10001 # 포트 1개면 항상 그 포트
|
||||
|
||||
|
||||
def test_rotate_advances_port_immediately():
|
||||
p = _p(port_start=10001, port_end=10003) # 포트 3개
|
||||
before = p._port()
|
||||
p.rotate()
|
||||
after = p._port()
|
||||
assert after != before # 즉시 다음 포트(새 IP)
|
||||
assert 10001 <= after <= 10003
|
||||
p.rotate(); p.rotate() # 3번 회전하면 한 바퀴 → 원위치
|
||||
assert p._port() == before
|
||||
Reference in new issue
Block a user