third dahua xunxi speaker 优化3

This commit is contained in:
caoqianming 2023-01-02 23:19:18 +08:00
parent 7e3a1f4f78
commit 4d96f2d77a
3 changed files with 15 additions and 9 deletions

View File

@ -85,8 +85,10 @@ class DhClient:
return 'fail', err_detail
# self.handle_log(result='success', response=ret) # 成功的日志就不记录了
return 'success', ret['data'] if 'data' in ret else None
else:
self.handle_log(result='error', response=ret)
except RequestException:
self.handle_log(result='error', response=None)
self.handle_log(result='error', errors=traceback.format_exc())
if raise_exception:
raise APIException(**DH_REQUEST_ERROR)
return 'error', DH_REQUEST_ERROR

View File

@ -80,8 +80,10 @@ class SpClient:
return 'fail', err_detail
# self.handle_log(result='success', response=ret)
return 'success', ret
else:
self.handle_log(result='error', response=ret)
except RequestException:
self.handle_log(result='error', response=None)
self.handle_log(result='error', errors=traceback.format_exc())
if raise_exception:
raise APIException(**SP_REQUEST_ERROR)
return 'error', SP_REQUEST_ERROR

View File

@ -73,8 +73,10 @@ class XxClient:
raise ParseError(**err_detail)
return 'fail', err_detail
return 'success', ret['data']
else:
self.handle_log(result='error', response=ret)
except RequestException:
self.handle_log(result='error', response=None)
self.handle_log(result='error', errors=traceback.format_exc())
if raise_exception:
raise APIException(**XX_REQUEST_ERROR)
return 'error', XX_REQUEST_ERROR