File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
src/saic_ismart_client_ng/api Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 88import dacite
99import httpx
1010import tenacity
11+ from httpx import TimeoutException
1112from httpx ._types import QueryParamTypes , HeaderTypes
1213
1314from saic_ismart_client_ng .api .schema import LoginResp
@@ -181,15 +182,15 @@ async def deserialize(
181182 raise se
182183 except Exception as e :
183184 if response .is_error :
184- if response .status_code == 401 :
185- await self ._handle_logout (
186- error_message = response .text ,
187- return_code = response .status_code ,
188- response = response ,
185+ if response .status_code in (401 , 403 ):
186+ logger .error (
187+ f"API call failed due to an authentication failure: { response .status_code } { response .text } "
189188 )
189+ self .logout ()
190+ raise SaicLogoutException (response .text , response .status_code )
190191 else :
191- logger .error (f"API call failed: { response .text } " )
192- raise SaicApiException (f"API call failed with status code { response .status_code } : { response .text } " )
192+ logger .error (f"API call failed: { response .status_code } { response . text } " )
193+ raise SaicApiException (response .text , response .status_code )
193194 else :
194195 raise SaicApiException (f"Failed to deserialize response: { e } . Original json was { response .text } " ) from e
195196
You can’t perform that action at this time.
0 commit comments