Registry / aws / aliyun-python-sdk-core-v3

aliyun-python-sdk-core-v3

JSON →
library2.13.33pypypiunverified

The `aliyun-python-sdk-core-v3` library provides the foundational components for interacting with Alibaba Cloud services using Python. It includes core functionalities like client initialization (`AcsClient`), request signing, and common request structures, upon which service-specific SDKs are built. The current version is 2.13.33, with releases occurring irregularly but consistently to support new features and fixes across Alibaba Cloud's ecosystem.

pip install aliyun-python-sdk-core-v3
INSTALL
IMPORT
SIG · ALIYUN-PYTHON-SDK-
A
aliyun-python-sdk-core-v3
awspythonv2.13.33
Install
3.8s avg
Import
394ms
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.13.33 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.251s · 39.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.8s · import 0.221s · 40MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AcsClient
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.client import AcsClient

This quickstart demonstrates how to initialize the `AcsClient` with credentials and make a generic `CommonRequest` to an Alibaba Cloud service (e.g., listing ECS regions). It emphasizes using environment variables for sensitive data.

import os from aliyunsdkcore.client import AcsClient from aliyunsdkcore.request import CommonRequest # Get credentials from environment variables or provide them directly access_key_id = os.environ.get('ALIYUN_AK_ID', 'YOUR_ACCESS_KEY_ID') access_key_secret = os.environ.get('ALIYUN_AK_SECRET', 'YOUR_ACCESS_KEY_SECRET') region_id = os.environ.get('ALIYUN_REGION', 'cn-hangzhou') # Initialize the AcsClient client = AcsClient(access_key_id, access_key_secret, region_id) # Create a CommonRequest for a service (e.g., ECS - DescribeRegions) request = CommonRequest() request.set_domain('ecs.aliyuncs.com') # Example: ECS service domain request.set_version('2014-05-26') # Example: API version request.set_action_name('DescribeRegions') # Example: API action request.set_method('POST') # Example: HTTP method # Send the request and print the response try: response = client.do_action_with_exception(request) print(f"API Response: {response.decode('utf-8')}") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaThe import path `aliyunsdkcore` does not directly reflect the PyPI package name `aliyun-python-sdk-core-v3`. This is a common source of `ModuleNotFoundError`.
fix
Always use `from aliyunsdkcore.client import AcsClient` and `from aliyunsdkcore.request import CommonRequest`.
affects: All versions
gotchaFor robust error handling, always prefer `client.do_action_with_exception(request)` over the older `client.do_action(request)`. The latter can silently fail or return incomplete responses without raising an exception.
fix
Update your API calls to use `do_action_with_exception` and wrap them in a try-except block to handle potential `ClientException` or `ServerException`.
affects: All versions
gotchaAuthentication failures are common due to incorrect `AccessKeyId`, `AccessKeySecret`, or an unsupported `region_id`. Errors like `InvalidAccessKeyId.NotFound` or `SignatureDoesNotMatch` indicate credential issues.
fix
Ensure your `ALIYUN_AK_ID`, `ALIYUN_AK_SECRET`, and `ALIYUN_REGION` environment variables are correctly set and correspond to active, valid credentials and a region that supports the requested service.
affects: All versions
Upgrade
Version history
2.13.33latest on PyPI · released Feb 7, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
38 hits · last 30 days
node
30
Perplexity
1
Resources
aliyun-python-sdk-core-v3 — pip install aliyun-python-sdk-core-v3 · libregistry