third dahua xunxi speaker 优化3
This commit is contained in:
parent
7e3a1f4f78
commit
4d96f2d77a
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue