aliyun / aliyun-openapi-python-sdk

Alibaba Cloud SDK for Python
Other
1.01k stars 588 forks source link

Missing get_ClientToken and set_ClientToken on ecs invoke command #276

Closed yokzy88 closed 5 years ago

yokzy88 commented 5 years ago

Missing method get_ClientToken and set_ClientToken on invoke command: https://github.com/aliyun/aliyun-openapi-python-sdk/blob/master/aliyun-python-sdk-ecs/aliyunsdkecs/request/v20140526/InvokeCommandRequest.py

Got the following error when using the SDK in function compoute: HTTP Status: 400 Error:MissingParameter The input parameter \"SecurityToken\" that is mandatory for processing this request is not supplied "errorType": "ServerException", "stackTrace": [ [ "File \"/code/index.py\"", "line 24", "in handler", "response = client.do_action_with_exception(request)" ], [ "File \"/usr/local/lib/python3.6/site-packages/aliyunsdkcore/client.py\"", "line 456", "in do_action_with_exception", "raise exception" ] ]

suvieyan commented 5 years ago

Using API InvokeCommandRequest with reference https://www.alibabacloud.com/help/doc-detail/64741.html. More infomation about the API InvokeCommandRequest , please submit a work order to resolve. This issue will be closed.

yokzy88 commented 5 years ago

Hi @wallisyan , I'm already using your reference. I got the same error message:

2019-08-07T03:31:52.714Z f6350308-7781-4593-8430-ae3684cf1387 [ERROR] ServerException occurred. Host:ecs.ap-southeast-5.aliyuncs.com SDK-Version:2.13.5 ServerException:HTTP Status: 400 Error:MissingParameter The input parameter "SecurityToken" that is mandatory for processing this request is not supplied. RequestID: F4328ACC-CD62-4D3D-8497-2DD0724EBF4D

2019-08-07T03:31:52.714Z f6350308-7781-4593-8430-ae3684cf1387 [INFO] b'{"Recommend":"https://error-center.aliyun.com/status/search?Keyword=MissingParameter&source=PopGw","Message":"The input parameter \"SecurityToken\" that is mandatory for processing this request is not supplied.","RequestId":"F4328ACC-CD62-4D3D-8497-2DD0724EBF4D","HostId":"ecs.ap-southeast-5.aliyuncs.com","Code":"MissingParameter"}'

2019-08-07T03:31:52.714Z f6350308-7781-4593-8430-ae3684cf1387 [INFO] invoke command failed

I think the difference is, I'm running the Invoke Command inside a Function Compute. Here's how I got the credential: def handler(event, context): creds = context.credentials clt = client.AcsClient(creds.accessKeyId, creds.accessKeySecret, 'ap-southeast-5')

suvieyan commented 5 years ago

API problem SDK can't do anything, please submit a work order to solve. This issue will be closed.