|
@@ -57,7 +57,6 @@ def generate_utk(request):
|
|
|
|
|
|
|
|
|
|
# 设备影子更新
|
|
# 设备影子更新
|
|
-@ratelimit(key='ip', rate='1/1d', block=True)
|
|
|
|
def update_device_shadow(request):
|
|
def update_device_shadow(request):
|
|
request.encoding = 'utf-8'
|
|
request.encoding = 'utf-8'
|
|
response = ResponseObject()
|
|
response = ResponseObject()
|
|
@@ -69,11 +68,15 @@ def update_device_shadow(request):
|
|
return response.json(444)
|
|
return response.json(444)
|
|
logger = logging.getLogger('info')
|
|
logger = logging.getLogger('info')
|
|
try:
|
|
try:
|
|
- etk = request_dict.get('etk', None)
|
|
|
|
- eto = ETkObject(etk)
|
|
|
|
- uid = eto.uid
|
|
|
|
- if not uid:
|
|
|
|
- return JsonResponse(status=200, data={'code': 403, 'msg': 'error etk'})
|
|
|
|
|
|
+ try:
|
|
|
|
+ etk = request_dict.get('etk', None)
|
|
|
|
+ eto = ETkObject(etk)
|
|
|
|
+ uid = eto.uid
|
|
|
|
+ if not uid:
|
|
|
|
+ return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
|
+ except Exception:
|
|
|
|
+ return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
|
|
+
|
|
logger.info('使用配置: {}'.format(SERVER_TYPE))
|
|
logger.info('使用配置: {}'.format(SERVER_TYPE))
|
|
logger.info('data: {}'.format(request_dict.dict()))
|
|
logger.info('data: {}'.format(request_dict.dict()))
|
|
|
|
|
|
@@ -196,4 +199,4 @@ def update_device_shadow(request):
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logger.info('更新设备影子异常: {}'.format(repr(e)))
|
|
logger.info('更新设备影子异常: {}'.format(repr(e)))
|
|
- return JsonResponse(status=500, data={'update_shadow_error': repr(e)})
|
|
|
|
|
|
+ return JsonResponse(status=200, data={'code': 0, 'msg': 'success', 'data': {}})
|