diff --git a/apps/third/dahua.py b/apps/third/dahua.py index 4c6c77a9..7b894dd0 100644 --- a/apps/third/dahua.py +++ b/apps/third/dahua.py @@ -8,7 +8,6 @@ import uuid import requests from django.conf import settings from rest_framework.exceptions import APIException, ParseError -from requests.exceptions import RequestException from apps.third.errors import DH_REQUEST_ERROR from apps.third.models import Tlog @@ -85,8 +84,8 @@ class DhClient: return 'fail', err_detail # self.handle_log(result='success', response=ret) # 成功的日志就不记录了 return 'success', ret['data'] if 'data' in ret else None - except RequestException: - self.handle_log(result='error', response=None) + except Exception: + self.handle_log(result='error', response=None, errors=traceback.format_exc()) if raise_exception: raise APIException(**DH_REQUEST_ERROR) return 'error', DH_REQUEST_ERROR diff --git a/apps/third/speaker.py b/apps/third/speaker.py index 3b10f266..80b2235d 100644 --- a/apps/third/speaker.py +++ b/apps/third/speaker.py @@ -7,7 +7,6 @@ import logging import requests from rest_framework.exceptions import APIException, ParseError from django.conf import settings -from requests.exceptions import RequestException from apps.third.errors import SP_REQUEST_ERROR from apps.third.models import Tlog @@ -80,8 +79,8 @@ class SpClient: return 'fail', err_detail # self.handle_log(result='success', response=ret) return 'success', ret - except RequestException: - self.handle_log(result='error', response=None) + except Exception: + self.handle_log(result='error', response=None, errors=traceback.format_exc()) if raise_exception: raise APIException(**SP_REQUEST_ERROR) return 'error', SP_REQUEST_ERROR diff --git a/apps/third/xunxi.py b/apps/third/xunxi.py index 192991d1..f71bc1a4 100644 --- a/apps/third/xunxi.py +++ b/apps/third/xunxi.py @@ -6,7 +6,6 @@ import uuid import requests from django.conf import settings from rest_framework.exceptions import APIException, ParseError -from requests.exceptions import RequestException from apps.third.errors import XX_REQUEST_ERROR from apps.third.models import Tlog @@ -73,8 +72,8 @@ class XxClient: raise ParseError(**err_detail) return 'fail', err_detail return 'success', ret['data'] - except RequestException: - self.handle_log(result='error', response=None) + except Exception: + self.handle_log(result='error', response=None, errors=traceback.format_exc()) if raise_exception: raise APIException(**XX_REQUEST_ERROR) return 'error', XX_REQUEST_ERROR