产品概述
产品功能
底层引擎
产品优势
应用场景
基本概念
pip install tencentcloud-sdk-python
$ cd tencentcloud-sdk-python$ python setup.py install
# -*- coding: utf-8 -*-import jsonimport typesfrom tencentcloud.common import credentialfrom tencentcloud.common.profile.client_profile import ClientProfilefrom tencentcloud.common.profile.http_profile import HttpProfilefrom tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExceptionfrom tencentcloud.tbaas.v20180416 import tbaas_client, modelstry:# 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密cred = credential.Credential("", "")# 实例化一个http选项,可选的,没有特殊需求可以跳过httpProfile = HttpProfile()httpProfile.endpoint = "tbaas.intl.tencentcloudapi.com"# 实例化一个client选项,可选的,没有特殊需求可以跳过clientProfile = ClientProfile()clientProfile.httpProfile = httpProfile# 实例化要请求产品的client对象,clientProfile是可选的client = tbaas_client.TbaasClient(cred, "ap-hongkong", clientProfile)# 实例化一个请求对象,每个接口都会对应一个request对象req = models.InvokeFabricChaincodeRequest()params = {"ClusterId": "fabric-65z42qi150","ChannelId": "channel-9xej4d","ChaincodeName": "fact","FuncName": "Set","FuncParam": [ "key", "value" ],"WithAsyncResult": False}req.from_json_string(json.dumps(params))# 返回的resp是一个InvokeFabricChaincodeResponse的实例,与请求对象对应resp = client.InvokeFabricChaincode(req)# 输出json格式的字符串回包print(resp.to_json_string())except TencentCloudSDKException as err:print(err)
文档反馈