|
@@ -40,7 +40,7 @@ class IotCoreView(View):
|
|
|
lang = request_dict.get('lang', 'en')
|
|
|
response.lang = lang
|
|
|
if operation == 'createKeysAndCertificate': # 设备注册到IoT core
|
|
|
- return self.create_keys_and_certificate(request_dict, response, request)
|
|
|
+ return self.create_key_and_certificate(request_dict, response)
|
|
|
elif operation == 'requestPublishMessage':
|
|
|
return self.request_publish_message(request_dict, response)
|
|
|
elif operation == 'getS3PullKey':
|
|
@@ -64,7 +64,7 @@ class IotCoreView(View):
|
|
|
|
|
|
# 设备注册到aws iot core
|
|
|
@staticmethod
|
|
|
- def create_keys_and_certificate(request_dict, response, request):
|
|
|
+ def create_key_and_certificate(request_dict, response):
|
|
|
logger = logging.getLogger('info')
|
|
|
logger.info('设备注册到aws iot core请求参数:{}'.format(request_dict))
|
|
|
token = request_dict.get('token', None)
|
|
@@ -130,8 +130,7 @@ class IotCoreView(View):
|
|
|
return response.json(0, {'res': res})
|
|
|
else:
|
|
|
# 获取并判断region_id是否有效
|
|
|
- region_id = request_dict.get('region_id', None)
|
|
|
- region_id = int(region_id) if region_id else CommonService.confirm_region_id()
|
|
|
+ region_id = CommonService.confirm_region_id()
|
|
|
if region_id not in [1, 2, 3, 4]:
|
|
|
return response.json(444, {'invalid region_id': region_id})
|
|
|
|
|
@@ -198,8 +197,7 @@ class IotCoreView(View):
|
|
|
return response.json(13)
|
|
|
|
|
|
# 获取并判断region_id是否有效
|
|
|
- region_id = request_dict.get('region_id', None)
|
|
|
- region_id = int(region_id) if region_id else CommonService.confirm_region_id()
|
|
|
+ region_id = CommonService.confirm_region_id()
|
|
|
if region_id not in [1, 2, 3, 4]:
|
|
|
return response.json(444, {'invalid region_id': region_id})
|
|
|
|