← 返回 Skills 市场
yndu13

Alibabacloud Sdk Client Initialization For Python

作者 yndu13 · GitHub ↗ · v0.0.1-beta · MIT-0
cross-platform ⚠ suspicious
103
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alibabacloud-sdk-client-initialization-for-python
功能描述
Initialize and manage Alibaba Cloud SDK clients in Python. Covers singleton pattern, thread safety, endpoint vs region configuration, VPC endpoints, async mo...
使用说明 (SKILL.md)

Client Initialization Best Practices (Python)

Core Rules

  • Client is thread-safe — safe to share across threads without additional locking.
  • Use singleton pattern — do NOT create new client instances per request. Frequent client creation wastes resources.
  • Prefer explicit endpoint over region-based endpoint resolution.

Recommended Client Creation

import os
from threading import Lock
from alibabacloud_tea_openapi.models import Config
from alibabacloud_ecs20140526.client import Client as EcsClient

_client = None
_lock = Lock()

def get_ecs_client() -> EcsClient:
    global _client
    if _client is None:
        with _lock:
            if _client is None:
                config = Config(
                    access_key_id=os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
                    access_key_secret=os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'],
                    endpoint='ecs.cn-hangzhou.aliyuncs.com',
                )
                _client = EcsClient(config)
    return _client

Endpoint Configuration

Priority: explicit endpoint > region-based resolution via region_id.

# Preferred: explicit endpoint
config = Config(endpoint='ecs.cn-hangzhou.aliyuncs.com')

# Alternative: SDK resolves endpoint from region
config = Config(region_id='cn-hangzhou')

VPC Endpoints

Use VPC endpoints when running inside Alibaba Cloud VPC:

config = Config(endpoint='ecs-vpc.cn-hangzhou.aliyuncs.com')

File Upload APIs (Advance)

Set both region_id and endpoint to the same region. Optionally set open_platform_endpoint and endpoint_type for VPC:

config = Config(
    region_id='cn-shanghai',
    endpoint='objectdet.cn-shanghai.aliyuncs.com',
    open_platform_endpoint='openplatform-vpc.cn-shanghai.aliyuncs.com',
    endpoint_type='internal',
)

SDK Components

Component Install Command
Core SDK pip install alibabacloud-tea-openapi
Product SDK pip install alibabacloud_ecs20140526 (example)

Async Mode

Python SDK supports async calls via _async method suffix:

import asyncio
from alibabacloud_ecs20140526.client import Client
from alibabacloud_ecs20140526.models import DescribeImagesRequest
from alibabacloud_tea_openapi.models import Config

async def main():
    config = Config(
        access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID'),
        access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
        endpoint='ecs-cn-hangzhou.aliyuncs.com',
    )
    client = Client(config)
    request = DescribeImagesRequest(region_id='cn-hangzhou')
    response = await client.describe_images_async(request)
    return response

asyncio.run(main())
安全使用建议
This skill appears to be a legitimate SDK initialization guide, but it references ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET inside the examples while the skill metadata lists no required credentials — that's an inconsistency you should resolve before use. Before installing or running code from this skill: (1) ask the publisher to declare required env vars/credentials explicitly; (2) never provide long-lived root credentials — use least-privilege RAM users or instance/RAM roles; (3) avoid pasting secrets into interactive chats or allowing the agent to fetch them without explicit consent; (4) if you run the provided code, test in an isolated environment with disposable credentials; and (5) prefer the examples that use safe retrieval (os.environ.get or explicit config) and handle missing credentials rather than ones that will raise and potentially leak debug info. If the skill will be allowed to run autonomously, require explicit user confirmation before it can access or request credentials.
功能分析
Type: OpenClaw Skill Name: alibabacloud-sdk-client-initialization-for-python Version: 0.0.1-beta The skill bundle provides standard documentation and code examples for initializing Alibaba Cloud SDK clients in Python. It correctly identifies best practices such as using the singleton pattern and thread safety, and uses standard environment variables for credential management without any signs of data exfiltration or malicious execution in SKILL.md.
能力评估
Purpose & Capability
The skill's name and description (Alibaba Cloud SDK client initialization) match the instructions in SKILL.md. However, the skill metadata declares no required environment variables or credentials even though the provided examples directly read ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET from the environment. That metadata omission is an incoherence — if the skill is intended to run code that creates SDK clients, it legitimately needs credentials and should declare them.
Instruction Scope
SKILL.md includes runnable Python code that reads os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'] and os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'] (and also shows os.environ.get in another example). Reading these secrets is directly relevant to initializing SDK clients, but the instructions do not handle missing credentials safely (one example uses direct indexing which raises if unset). The doc does not instruct the agent to access unrelated files, but it does implicitly require access to sensitive environment variables not advertised in the metadata.
Install Mechanism
This is an instruction-only skill with no install spec or code files (lowest install risk). The SKILL.md recommends installing packages via pip (alibabacloud-tea-openapi and product SDKs). Pip installs from PyPI are common and expected for a Python SDK guide; they carry moderate supply-chain risk but are proportional to the stated purpose.
Credentials
The only sensitive items referenced are standard Alibaba Cloud access keys, which are proportionate to SDK initialization. The problem is the metadata declares no required env vars or primary credential while the instructions clearly rely on them. This mismatch raises the risk that credentials could be requested or accessed without clear user expectation. Also one code example uses os.environ[...] (KeyError risk) rather than safe retrieval patterns.
Persistence & Privilege
The skill does not request always:true, does not modify other skills, and has no install actions that persist code on disk. Autonomous invocation is allowed (platform default) but that alone is not a problem; combined with the undocumented credential access it does increase potential blast radius and should be considered by the user.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-sdk-client-initialization-for-python
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-sdk-client-initialization-for-python 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1-beta
Initial beta release. - Provides best practices for initializing and managing Alibaba Cloud SDK clients in Python. - Documents thread safety, singleton pattern implementation, and efficient client reuse. - Explains endpoint versus region-based configuration, with special instructions for VPC endpoints and file upload APIs. - Includes guidance on installing required SDK components. - Details usage of async methods in the Python SDK.
元数据
Slug alibabacloud-sdk-client-initialization-for-python
版本 0.0.1-beta
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Alibabacloud Sdk Client Initialization For Python 是什么?

Initialize and manage Alibaba Cloud SDK clients in Python. Covers singleton pattern, thread safety, endpoint vs region configuration, VPC endpoints, async mo... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 103 次。

如何安装 Alibabacloud Sdk Client Initialization For Python?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alibabacloud-sdk-client-initialization-for-python」即可一键安装,无需额外配置。

Alibabacloud Sdk Client Initialization For Python 是免费的吗?

是的,Alibabacloud Sdk Client Initialization For Python 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alibabacloud Sdk Client Initialization For Python 支持哪些平台?

Alibabacloud Sdk Client Initialization For Python 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alibabacloud Sdk Client Initialization For Python?

由 yndu13(@yndu13)开发并维护,当前版本 v0.0.1-beta。

💬 留言讨论