@@ -41,7 +41,7 @@ from ksyun.common import credential
4141from ksyun.common.profile.client_profile import ClientProfile
4242from ksyun.common.profile.http_profile import HttpProfile
4343from ksyun.common.exception.ksyun_sdk_exception import KsyunSDKException
44- from ksyun.client.iam.v20151101 import client, models
44+ from ksyun.client.iam.v20151101 import client as iam_client , models as iam_models
4545
4646try :
4747 # 实例化一个证书对象,入参需要传入secretId,secretKey
5555 httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)
5656
5757 clientProfile = ClientProfile()
58+ # clientProfile.signMethod = "HMAC-SHA256" # 指定签名算法
5859 clientProfile.httpProfile = httpProfile
59- client = client .IamClient(cred, " cn-beijing-6" , clientProfile)
60+ iamClient = iam_client .IamClient(cred, " cn-beijing-6" , clientProfile)
6061
6162 # 实例化一个请求对象, 每个接口都会对应一个request对象。
62- req = models .CreateUserRequest()
63+ iamReq = iam_models .CreateUserRequest()
6364 # 传参
64- req .UserName = " test2_user_name"
65+ iamReq .UserName = " test2_user_name"
6566 # 调用接口返回
66- resp = client .CreateUser(req )
67- print (resp )
67+ iamResp = iamClient .CreateUser(iamReq )
68+ print (iamResp )
6869except KsyunSDKException as err:
6970 print (err)
71+
7072```
7173
7274** 注意,您必须明确知道您调用的接口所需参数,否则可能会调用失败。**
0 commit comments