2 Star 0 Fork 1

yeluo/huawei-iotda-tools

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
client.py 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
yeluo 提交于 2022-07-06 14:32 . 更新pip
import importlib
import json
from huaweicloudsdkcore.sdk_stream_request import SdkStreamRequest
from huaweicloudsdkcore.utils import http_utils
from huaweicloudsdkiotda.v5 import IoTDAClient
class IoTDAClientEx(IoTDAClient):
def __init__(self):
self.preset_headers = {}
self._agent = {"User-Agent": "huaweicloud-usdk-python/3.0"}
self._logger = self._init_logger()
self._credentials = None
self._config = None
self._endpoint = None
self._http_client = None
self._http_handler = None
self.model_package = None
try:
exception_handler_model_name = "huaweicloudsdkiotda.v5.exception_handler"
self.exception_handler_model = importlib.import_module(exception_handler_model_name)
except ImportError:
self.exception_handler_model = None
self.model_package = importlib.import_module("huaweicloudsdkiotda.v5.model")
self.preset_headers = {'User-Agent': 'HuaweiCloud-SDK-Python'}
def update_product_ex(self, request, shadow_store):
return self.update_product_with_http_info_ex(request, shadow_store)
def update_product_with_http_info_ex(self, request, shadow_store):
all_params = ['product_id', 'update_product_request_body', 'instance_id']
local_var_params = {}
for attr in request.attribute_map:
if hasattr(request, attr):
local_var_params[attr] = getattr(request, attr)
collection_formats = {}
path_params = {}
if 'product_id' in local_var_params:
path_params['product_id'] = local_var_params['product_id']
query_params = []
header_params = {}
if 'instance_id' in local_var_params:
header_params['Instance-Id'] = local_var_params['instance_id']
form_params = {}
body_params = None
if 'body' in local_var_params:
body_params = local_var_params['body']
if isinstance(request, SdkStreamRequest):
body_params = request.get_file_stream()
body_params = body_params.to_dict()
body_params["settings"] = {"shadow.store": shadow_store}
response_headers = []
header_params['Content-Type'] = http_utils.select_header_content_type(
['application/json;charset=UTF-8'])
auth_settings = []
return self.call_api(
resource_path='/v5/iot/{project_id}/products/{product_id}',
method='PUT',
path_params=path_params,
query_params=query_params,
header_params=header_params,
body=body_params,
post_params=form_params,
response_type='UpdateProductResponse',
response_headers=response_headers,
auth_settings=auth_settings,
collection_formats=collection_formats,
request_type=request.__class__.__name__)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qinghanfun/huawei-iotda-tools.git
git@gitee.com:qinghanfun/huawei-iotda-tools.git
qinghanfun
huawei-iotda-tools
huawei-iotda-tools
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385