TencentCloudSDKException Traceback (most recent call last)
<ipython-input-11-a7f6fc5027e7> in <module>
30 req.from_json_string(params)
31
---> 32 resp = client.ChangeAgePic(req)
33 print(resp.to_json_string())
34
~/anaconda3/lib/python3.6/site-packages/tencentcloud_sdk_python-3.0.162-py3.6.egg/tencentcloud/ft/v20200304/ft_client.py in ChangeAgePic(self, request)
46 message = response["Response"]["Error"]["Message"]
47 reqid = response["Response"]["RequestId"]
---> 48 raise TencentCloudSDKException(code, message, reqid)
49 except Exception as e:
50 if isinstance(e, TencentCloudSDKException):
TencentCloudSDKException: [TencentCloudSDKException] code:MissingParameter message:The request is missing a required parameter `AgeInfos`. requestId:7eb86f37-2485-4122-99c6-31761d16e020
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.ft.v20200304 import ft_client,models
import tencentcloud
import json
print(tencentcloud.__version__)
# 人脸变化 年轻
# try:
cred = credential.Credential("", "")
httpProfile = HttpProfile()
httpProfile.endpoint = "ft.tencentcloudapi.com"
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
client = ft_client.FtClient(cred, "ap-beijing", clientProfile)
req = models.ChangeAgePicRequest()
#'{"FunctionName":"hello","InvocationType":"RequestResponse","Namespace":"default"}'
params = '{"Action":"ChangeAgePic","Version":"2020-03-04","AgeInfos":"{"age":"1"}","Image":""}'
data = {"Action":"ChangeAgePic","Version":"2020-03-04","AgeInfos":[{"age":"1",'FaceRect':None}],"Image":"",'Url':''}
params =json.dumps(data)
print(type(params),params)
params1 = json.loads(params)
for item in params1.get("AgeInfos"):
print(item)
print(params1)
req.from_json_string(params)
resp = client.ChangeAgePic(req)
print(resp.to_json_string())
相似问题