This topic describes how to install SDKs for Python and provides sample code.

Background information

  • Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to debug API operations and dynamically generate SDK sample code.
  • For more information about Resource Management API operations, see List of operations by function.


To install the SDKs for Python, you can run the pip command, or download the installation packages of the SDKs and add the packages to your project. For more information, see Quick start.


The following example shows how to use Resource Management SDK for Python to call the CreateResourceAccount API operation. You can visit OpenAPI Explorer to debug other API operations and obtain their sample code.

#!/usr/bin/env python
#coding = utf - 8
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkresourcemanager.request.v20200331.CreateResourceAccountRequest import CreateResourceAccountRequest
# Construct an Alibaba Cloud client that is used to initiate requests.
# When you construct the client, specify your AccessKey ID and AccessKey secret.
client = AcsClient('<accessKeyId>', '<accessSecret>', 'cn-shanghai')
# Construct the request object.
request = CreateResourceAccountRequest()
# Configure parameters.
# Initiate the request and obtain a response.
response = client.do_action_with_exception(request)
#python2: print(response)
print(str(response, encoding = 'utf-8'))