Registry / aws / aliyun-python-sdk-core

aliyun-python-sdk-core

JSON →
library2.16.1pypypi✓ verified 25d ago

The `aliyun-python-sdk-core` is the foundational module of the Alibaba Cloud Python SDK (V1.0). It provides essential functionalities such as the client object, signature logic, and common exception handling, simplifying the process of integrating Python applications with various Alibaba Cloud services. While still actively maintained for security, new feature development has ceased, and Alibaba Cloud recommends migrating new projects to the V2.0 SDK for enhanced performance and features.

pip install aliyun-python-sdk-core
INSTALL
IMPORT
SIG · ALIYUN-PYTHON-SDK-
A
aliyun-python-sdk-core
awspythonv2.16.1
Install
3.0s avg
Import
374ms
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.16.1 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.394s · 38.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.0s · import 0.354s · 39MB
37MB installed
● package 37MB
Code
Verified usage

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

AcsClient
from aliyunsdkcore.client import AcsClient
ClientException
from aliyunsdkcore.acs_exception.exceptions import ClientException
ServerException
from aliyunsdkcore.acs_exception.exceptions import ServerException

This quickstart demonstrates how to initialize the `AcsClient` with AccessKey credentials and a region ID. Credentials should ideally be managed via environment variables for security. After initialization, you would typically import and configure service-specific request objects and use the client to send API calls.

import os from aliyunsdkcore.client import AcsClient from aliyunsdkcore.acs_exception.exceptions import ClientException, ServerException ACCESS_KEY_ID = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_ID') ACCESS_KEY_SECRET = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', 'YOUR_ACCESS_KEY_SECRET') REGION_ID = os.environ.get('ALIBABA_CLOUD_REGION_ID', 'cn-hangzhou') # e.g., 'cn-hangzhou' try: # Initialize the AcsClient instance client = AcsClient(ACCESS_KEY_ID, ACCESS_KEY_SECRET, REGION_ID) print(f"AcsClient initialized successfully for region {REGION_ID}") # In a real scenario, you would then create a request object for a specific service # and send it using client.do_action_with_exception(request) # For example: # from aliyunsdkecs.request.v20140526 import DescribeRegionsRequest # request = DescribeRegionsRequest.DescribeRegionsRequest() # response = client.do_action_with_exception(request) # print(response.decode('utf-8')) except ClientException as e: print(f"Client Error: {e.error_code} - {e.message}") except ServerException as e: print(f"Server Error: {e.error_code} - {e.message}") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingThe `aliyun-python-sdk-core` (V1.0 SDK) is entering a basic security maintenance phase and will not receive new features. Alibaba Cloud strongly recommends migrating new projects to the V2.0 SDK (`alibabacloud-python-sdk`) for better performance, a more concise API, and continued feature development.
fix
For new projects, use `pip install alibabacloud-python-sdk` and refer to the V2.0 documentation. For existing projects, consider a migration strategy.
affects: All versions of `aliyun-python-sdk-core` (V1.0)
breakingStarting from version 2.16.0, `aliyun-python-sdk-core` officially requires Python 3.7 or higher. Earlier versions supported Python 2.7 and various Python 3.x versions.
fix
Ensure your Python environment is 3.7 or newer. Upgrade Python if necessary, or pin to an earlier SDK version if legacy Python is unavoidable.
affects: >=2.16.0
gotchaIncorrect `region_id` format during `AcsClient` initialization can lead to `SDK.MissingEndpointsFiler` or other endpoint resolution errors. Region IDs must follow the `cn-<Region>` or equivalent cloud-specific format.
fix
Always use a valid and correctly formatted region ID (e.g., 'cn-hangzhou', 'ap-southeast-1'). Refer to Alibaba Cloud documentation for available regions.
affects: All versions
gotchaModuleNotFoundError for SDK components or persistent installation issues can be caused by outdated `pip` or `setuptools`, or Python version conflicts.
fix
Ensure `pip` and `setuptools` are up-to-date (`pip install --upgrade pip setuptools`). If multiple Python versions are installed, ensure the SDK is installed for the correct interpreter (e.g., `pip3 install ...`). Clear pip cache if issues persist (`pip cache purge`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aliyunsdkcore.vendored.six.moves'
The 'six' module is missing or incompatible, leading to the SDK's inability to locate 'six.moves'.
fix
Install or upgrade the 'six' module using 'pip install --upgrade --force-reinstall six'.
ImportError: No module named 'aliyunsdkcore'
The 'aliyun-python-sdk-core' package is not installed or not properly installed in the Python environment.
fix
Install the package using 'pip install aliyun-python-sdk-core'.
ModuleNotFoundError: No module named 'aliyunsdkcore'
The 'aliyun-python-sdk-core' package is missing from the Python environment.
fix
Install the package using 'pip install aliyun-python-sdk-core'.
Error:MissingParameter The input parameter "AccessKeyId" that is mandatory for processing this request is not supplied.
This error indicates that the AccessKeyId or AccessKeySecret required for authentication with Alibaba Cloud services were not provided during the `AcsClient` initialization or are not configured as environment variables.
fix
Set the `ALIBABA_CLOUD_ACCESS_KEY_ID` and `ALIBABA_CLOUD_ACCESS_KEY_SECRET` environment variables, or pass them directly as arguments when creating the `AcsClient` instance: `client = AcsClient('YOUR_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY_SECRET', 'cn-hangzhou')`.
aliyunsdkcore.acs_exception.exceptions.ClientException: SDK.InvalidParameter The parameter region_id not match with ^[a-zA-Z0-9_-]+$.
This `ClientException` arises when the `region_id` provided during the `AcsClient` initialization is in an invalid format or does not correspond to a valid Alibaba Cloud region, or if an outdated SDK core package cannot identify the endpoint.
fix
Use a valid region ID in the `cn-<Region>` format (e.g., 'cn-hangzhou') and ensure your `aliyun-python-sdk-core` package is updated to the latest version via `pip install --upgrade aliyun-python-sdk-core`.
Upgrade
Version history
2.16.1latest on PyPI · released Aug 18, 2026
Audit
Dependencies
cryptographyrequiredUsed for secure communication and cryptographic operations within the SDK.
jmespathrequiredUsed for querying JSON data, potentially for parsing API responses.
Agent activity
71 hits · last 30 days
node
60
Perplexity
1
OpenAI (training)
1
Resources
aliyun-python-sdk-core — pip install aliyun-python-sdk-core · libregistry