無法登入API

有任何提問的都來這
回覆文章
tinayang0609
文章: 1
註冊時間: 2023-01-15, 17:51

無法登入API

文章 tinayang0609 »

import shioaji as sj

API_KEY = '遮'
SRE_KEY = '遮'

api = sj.Shioaji()
api.login(
api_key=API_KEY,
secret_key=SRE_KEY
)

收到如下:

Exception: {'status': {'status_code': 400}, 'response': {'token': '', 'accounts': [], 'detail': 'Sign data is timeout.', 'ip_address': '遮', 'person_id': '遮', 'client_name': '', 'contract_download': False, 'web_token': ''}}

請問要怎麼解決?
maxeii
系統管理員
文章: 44
註冊時間: 2021-09-01, 13:54

Re: 無法登入API

文章 maxeii »

請先在你的電腦上校時,這是因為你電腦時間跟標準時間有五秒以上落差,導致傳輸的token時間檢查不過。
syjhou
文章: 3
註冊時間: 2022-02-14, 16:16

Re: 無法登入API

文章 syjhou »

我是無法運行API。之前同樣的程式碼都沒問題
請問以下這是什麼錯誤訊息?

---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_126272/4283530658.py in <module>
1 import shioaji as sj
2
----> 3 api = sj.Shioaji()
4 #acount= api.login( person_id="S*********", passwd="**********")

~\anaconda3\lib\site-packages\shioaji\shioaji.py in __init__(self, backend, simulation, proxies, currency)
129 ) -> None:
130 pass
--> 131
132 @abc.abstractmethod
133 def set_on_bidask_stk_v1_callback(

shioaji\backend\solace\utils.pyx in shioaji.backend.solace.utils.read_config()

~\anaconda3\lib\configparser.py in __getitem__(self, key)
958 def __getitem__(self, key):
959 if key != self.default_section and not self.has_section(key):
--> 960 raise KeyError(key)
961 return self._proxies[key]
962

KeyError: 'stag'
回覆文章