aliyun / alibabacloud-python-sdk

78 stars 28 forks source link

[alibabacloud_cr20160607] get_authorization_token no data returned #7

Closed yongzhang closed 4 months ago

yongzhang commented 2 years ago

Code:

#!/usr/bin/env python3

from alibabacloud_credentials.client import Client as CredClient
from alibabacloud_cr20160607.client import Client
from alibabacloud_tea_openapi.models import Config

config = Config(
    region_id="cn-shanghai",
    credential=CredClient()
)

client = Client(config)

response = client.get_authorization_token()
print (response.to_map())

I got headers only:

{'headers': {'date': 'Wed, 02 Mar 2022 09:59:39 GMT', 'content-type': 'application/json;charset=utf-8', 'content-length': '222', 'connection': 'keep-alive', 'access-control-allow-origin': '*', 'access-control-allow-methods': 'POST, GET, OPTIONS, PUT, DELETE', 'access-control-allow-headers': 'X-Requested-With, X-Sequence, _aop_secret, _aop_signature, x-acs-action, x-acs-version, x-acs-date, Content-Type', 'access-control-max-age': '172800', 'x-acs-request-id': 'requestid', 'x-acs-trace-id': 'id', 'server': 'Tengine', 'content-language': 'zh-CN'}}

But I can get the token by aliyun cli:

$ aliyun cr GetAuthorizationToken
{
        "data": {
                "authorizationToken": "xxxxx",
                "expireDate": 1646219005000,
                "tempUserName": "cr_temp_user"
        }
}

Please help, thanks.

TsinghuaDream commented 4 months ago

cr20160607 has been made private.