fix: handle dict and list formats in overseas balance output2 (issue #41) #45
Reference in New Issue
Block a user
Delete Branch "feature/issue-41-keyerror-balance"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
output2[0]in overseas balance parsing[{}]and dict{}response formats from KIS APIProblem
Docker logs showed repeated KeyError crashes (15% of requests):
API response format varies between list and dict, causing index access failure.
Solution
Test Coverage
output2=[{...}]output2={...}output2=[]Closes
Closes #41
🤖 Generated with Claude Code
Add type checking for output2 response from get_overseas_balance API. The API can return either list format [{}] or dict format {}, causing KeyError when accessing output2[0]. Changes: - Check isinstance before accessing output2[0] - Handle list, dict, and empty cases - Add safe fallback with "or" for empty strings - Add 3 test cases for list/dict/empty formats Fixes: #41 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>