在網路斷線情況下去取資料,request_get無法正確回傳Exception訊息
cyyeh opened this issue · comments
Describe the bug (please complete the following information)[清晰簡潔的描述 bug]
A clear and concise description of what the bug is.
在網路斷線情況下去取資料,request_get
無法正確回傳Exception訊息,因為此時reponse的值是空的,因此 if response.json()["msg"] == "success" and response.status_code == 200:
會噴錯
To Reproduce (please complete the following information)[一步一步說明如何重現 bug]
Steps to reproduce the behavior:
- 斷網
- 呼叫FinMind api
- 出現The “local variable referenced before assignment” error
Expected behavior (please complete the following information)[清晰簡潔的描述你預期的結果]
A clear and concise description of what you expected to happen.
應該要回傳Exception
Desktop (please complete the following information):[提供程式的執行環境]
- OS: Mac
- Browser: Chrome
- Python Version: 3.10
- FinMind package Version: 1.6.4