[2026-05-22] 일일 리포트 — 14건 승7패7 -127,406원 / TimeoutError 로그 버그 수정
- reports/daily/2026-05-22.md 생성 - main.py: except 블록에 type(e).__name__ 추가 (빈 에러 메시지 방지) - kis_client._request: asyncio.TimeoutError 명시적 catch → RuntimeError re-raise
This commit is contained in:
@@ -182,13 +182,16 @@ class KISClient:
|
||||
self._req_times.append(time.monotonic())
|
||||
|
||||
_timeout = aiohttp.ClientTimeout(total=10)
|
||||
async with aiohttp.ClientSession(timeout=_timeout) as session:
|
||||
if method == "GET":
|
||||
async with session.get(url, headers=headers, params=params) as r:
|
||||
data = await r.json()
|
||||
else:
|
||||
async with session.post(url, headers=headers, json=body) as r:
|
||||
data = await r.json()
|
||||
try:
|
||||
async with aiohttp.ClientSession(timeout=_timeout) as session:
|
||||
if method == "GET":
|
||||
async with session.get(url, headers=headers, params=params) as r:
|
||||
data = await r.json()
|
||||
else:
|
||||
async with session.post(url, headers=headers, json=body) as r:
|
||||
data = await r.json()
|
||||
except asyncio.TimeoutError:
|
||||
raise RuntimeError(f"KIS API 타임아웃 [{tr_id}]")
|
||||
|
||||
# 응답 코드 체크
|
||||
rt_cd = data.get("rt_cd", "")
|
||||
|
||||
Reference in New Issue
Block a user