iT邦幫忙

2021 iThome 鐵人賽

DAY 10
1
永豐金融APIs

永豐證API X Python系列 第 10

【D10】廚房門被鎖住怎麼辦?(帳號鎖著了!)

前言

由於在換開發環境,以為是套件沒有安裝好,就在一切都覺得沒有問題後,發現還是無法登入,「這時才仔細看錯誤訊息」,原來被鎖住了!

可能沒有注意到密碼打錯,連續錯誤多次就會被鎖住,這時候該怎麼辦呢?


遇到狀況

這時候在登入這邊就會卡住,並回傳錯誤的訊息。

# 登入shioaji
api = sj.Shioaji()
api.login(
    person_id="id是我",
    passwd="密碼是我",
)

仔細看錯誤訊息,其實我已經錯誤達到三次passwd_err_3_times,所以鎖住。

Exception: {'status': {'status_code': 400}, 'response': {'token': '', 'accounts': [], 'detail': 'ORA-20006:   passwd_err_3_times\nORA-06512: at "STSTX.SGTP_LOGIN_G", line 407\nORA-06512: at line 1', 'ip_address': 'xxx', 'client_name': ''}}
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
/var/folders/6f/2dwt6kdj29v5m2j4y5jrg3bm0000gn/T/ipykernel_37768/1386890405.py in <module>
      1 # 登入shioaji
      2 api = sj.Shioaji()
----> 3 api.login(
      4     person_id="id是我",
      5     passwd="密碼是我",

因此無論怎樣,都無法登入,只好解鎖囉!

解鎖

  • 首先在永豐證的登入頁面中輸入自己的登入資訊,就會說你已經錯誤超過三次被鎖,需要用「忘記密碼」來解決。

https://ithelp.ithome.com.tw/upload/images/20210924/20103826HYeGYXgTxO.png

https://ithelp.ithome.com.tw/upload/images/20210924/20103826PeyCRUX8iV.png

  • 輸入個人資料,就可點擊「確認」,就可以解鎖囉!

https://ithelp.ithome.com.tw/upload/images/20210924/201038260yQnRjeiR0.png

  • 看到解鎖成功就是完成囉!

https://ithelp.ithome.com.tw/upload/images/20210924/20103826Ql0aDKCc6q.png

登入的其他狀態

  • 密碼錯誤,會有passwd_err,全部資訊會是這樣:
Exception: {'status': {'status_code': 400}, 'response': {'token': '', 'accounts': [], 'detail': 'ORA-20004:   passwd_err\nORA-06512: at "STSTX.SGTP_LOGIN_G", line 402\nORA-06512: at line 1', 'ip_address': 'xxx', 'client_name': ''}}
  • 登入成功,會帶入帳號資訊,會是這樣的訊息:
[Account(account_type=<AccountType.H: 'H'>, person_id='我是ID', broker_id='我是代號', account_id='我是帳號', username='我是名稱'),
 StockAccount(person_id='我是ID', broker_id='我是代號', account_id='我是帳號', signed=True, username='我是名稱\u3000\u3000')]

後記

出現個意外小插曲,還好快速解決!嚇死我的睫毛了!


上一篇
【D9】廚具熟練後製作精緻:使用歷史資料的Kbar做MA(移動平均線)圖
下一篇
【D11】再度熟悉廚具:合約
系列文
永豐證API X Python31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言