Skip to main content

企业工作台 python sdk

基本原理

在官网 SDK 的基础上,对 Client进行重写,满足企业工作台的调用逻辑,同时完全兼容官网 SDK,这样就形成了 企业工作台定制 Client + 官网 SDK 提供 APIMETA 的模式。

环境要求

  • 找阿里云企业工作台团队,提供 OpenAPI 访问凭证(consoleKey、consoleSecret)

SDK 获取与安装

使用 pip 安装(推荐)

pip install aliyun-console-bench-python-sdk

快速使用

企业工作台的业务模式分为 工作台托管、聚石塔自管 两种模式,因此API调用也有针对性区分。

工作台托管 SDK 调用示例

from one_sdk.client import OneClient
from aliyunsdkecs.request.v20140526.DescribeInstancesRequest import DescribeInstancesRequest

def test_client_api():
    client = OneClient(${consoleKey}, ${consoleSecret}, ${regionId})
    client.set_endpoint('console-bench.aliyuncs.com')
    client.add_query_param('AliUid', 'xxx')  # OneConsole传递的主账号id
    
    req = DescribeInstancesRequest()
    req.set_VpcId('xxx')

    res = client.do_action_with_exception(req)
    print(res)

说明:

  • endpoint: 测试环境下需要 host 绑定 114.55.202.134 console-bench.aliyuncs.com

聚石塔托管 SDK 调用示例

from one_sdk.client import OneClient
from aliyunsdkecs.request.v20140526.DescribeInstancesRequest import DescribeInstancesRequest

def test_client_api():
    client = OneClient(${consoleKey}, ${consoleSecret}, ${regionId})
    client.set_endpoint('console-bench.aliyuncs.com')
    client.add_query_param('IdToken', 'xxx')  # Oauth授权后获取的身份信息
    
    req = DescribeInstancesRequest()
    req.set_VpcId('xxx')

    res = client.do_action_with_exception(req)
    print(res)

说明:

  • endpoint: 测试环境下需要 host 绑定 114.55.202.134 console-bench.aliyuncs.com

许可证

Apache-2.0

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

Metadata

Release files for aliyun-console-bench-python-sdk 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aliyun-console-bench-python-sdk 1.0.0
File Size Uploaded
aliyun-console-bench-python-sdk-1.0.0.tar.gz 4.9 kB Details

Release files / aliyun-console-bench-python-sdk-1.0.0.tar.gz

Download URL aliyun-console-bench-python-sdk-1.0.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ed4300ea010f3a926e75cc31cd740f6965a6a22ebf94d2564ce824703d279cfd
BLAKE2b-256 checksum
How to use checksums
90a8c2aba20bbd141f0c45f0e78ef89ed3dcd1684a036ac7e3f38700a7ff9459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page