Alibaba Cloud Ims (20190815) SDK

3.3.6 · active · verified Fri Apr 17

The `alibabacloud-ims20190815` library is the Alibaba Cloud SDK for Identity Management Service (IMS), specifically for the API version dated 2019-08-15. It provides Python bindings to interact with IMS resources like users, groups, and access keys, simplifying API calls and response handling. It is currently at version 3.3.6 and receives regular maintenance updates as part of the broader Alibaba Cloud Python SDK ecosystem.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the IMS client using environment variables for authentication and make a basic API call to list access keys. It highlights the use of `Config` from `alibabacloud_tea_openapi` and the `Client` and `models` from the specific IMS SDK.

import os
from alibabacloud_ims20190815.client import Client as ImsClient
from alibabacloud_ims20190815 import models as ImsModels
from alibabacloud_tea_openapi.models import Config

# Ensure environment variables are set for authentication
# export ALIBABA_CLOUD_ACCESS_KEY_ID='your_access_key_id'
# export ALIBABA_CLOUD_ACCESS_KEY_SECRET='your_access_key_secret'

# Configure client with Access Key, Secret, and Region
# Default region 'cn-hangzhou' might work, but specify if needed.
config = Config(
    access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),
    access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', ''),
    region_id='cn-hangzhou' # Or your desired region, e.g., 'ap-southeast-1'
)

# If a specific endpoint is required (e.g., private link, specific region), uncomment and set it.
# config.endpoint = 'ims.cn-hangzhou.aliyuncs.com'

try:
    # Initialize the client
    client = ImsClient(config)

    # Create a request object (e.g., for listing access keys)
    list_access_keys_request = ImsModels.ListAccessKeysRequest()

    # Call the API
    response = client.list_access_keys(list_access_keys_request)

    # Print the response body
    print(response.body)

except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →