This topic describes how to install the RAM SDK for Python. It also provides an example about how to use the SDK.
Install the RAM SDK for Python
Run the pip command, or download the SDK packages and then add them to your project.
Use the RAM SDK for Python
The following sample code uses the RAM SDK for Python to create a RAM user.
#! /usr/bin/env python #coding=utf-8 from aliyunsdkcore import client from aliyunsdkram.request.v20150501 import CreateUserRequest # Construct an Alibaba Cloud client. The client will be used to send a request. # When you construct the client, set the AccessKey ID and AccessKey secret. # RAM is a global service. However, the RAM API endpoint is located in the China (Hangzhou) region. Therefore, specify cn-hangzhou. clt = client.AcsClient('<access-key-id>','<access-key-secret>','cn-hangzhou') # Construct a CreateUser request. request = CreateUserRequest.CreateUserRequest() # Specify the UserName parameter. request.set_UserName('alice') # Issue the request and obtain a response. response = clt.do_action(request) print response