This topic describes how to install Python SDK and provides an operation example.

Installation

You can use PIP to install Python SDK or download the Python SDK package and add the package to the target project.

  • Use PIP to install Python SDK:
    pip install aliyun-python-sdk-ram
  • Download the Python SDK package:

Example

The following is an example of how to create a RAM user by using Python SDK:

#!/usr/bin/env python
#coding=utf-8

from aliyunsdkcore import client
from aliyunsdkram.request.v20150501 import CreateUserRequest


# Construct an Alibaba Cloud client to initiate a request.
# Set the access key ID and access key secret.
# Alibaba Cloud Resource Access Management (RAM) is a global service. Its API endpoint is China (Hangzhou). Here, set "Region" to "cn-hangzhou".
clt = client.AcsClient('<access-key-id>','<access-key-secret>','cn-hangzhou')

# Construct the "CreateUser" request.
request = CreateUserRequest.CreateUserRequest()
# Set the "UserName" parameter.
request.set_UserName('alice')

# Initiate a request and obtain a response.
response = clt.do_action(request)

print response