Overview
Product Features
Underlying Engine
Strengths
Scenarios
Basic Concepts
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:# Instantiate an authentication object. Input parameters need to be passed in, including the SecretId and SecretKey of your Tencent Cloud account. Here, you also need to pay attention to keeping the confidentiality of the key pair.cred = credential.Credential("", "")# Instantiate an http option. It is optional and can be skipped if there are no specific requirements.httpProfile = HttpProfile()httpProfile.endpoint = "tbaas.intl.tencentcloudapi.com"# Instantiate a client option. It is optional and can be skipped if there are no specific requirements.clientProfile = ClientProfile()clientProfile.httpProfile = httpProfile# Instantiate the client object to request the product. clientProfile is optional.client = tbaas_client.TbaasClient(cred, "ap-hongkong", clientProfile)Instantiate a request object. Each API corresponds to a request object.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))# The returned resp is an instance of InvokeFabricChaincodeResponse, corresponding to the request object.resp = client.InvokeFabricChaincode(req)# Output a json-formatted string responseprint(resp.to_json_string())except TencentCloudSDKException as err:print(err)
피드백