Skip to content

Commit f4bfa3c

Browse files
committed
Raise exception for failed response from Guorn
1 parent cf3789c commit f4bfa3c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shipane_sdk/guorn/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,13 @@ def query_portfolio(self):
5353
}, timeout=self._timeout)
5454
instruction = response.json()
5555

56+
status = instruction['status']
5657
data = instruction['data']
57-
position = data['position']
58+
if status == 'failed':
59+
if isinstance(data, str):
60+
raise Exception(data)
61+
raise Exception("获取调仓指令数据失败")
62+
5863
df = pd.DataFrame()
5964
sheet_data = instruction['data']['sheet_data']
6065
for row in sheet_data['row']:

0 commit comments

Comments
 (0)