Skip to main content

Aliyun Console Bench SDK Library for Python

Project description

企业工作台 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aliyun-console-bench-python-sdk-1.0.0.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file aliyun-console-bench-python-sdk-1.0.0.tar.gz.

File metadata

  • Download URL: aliyun-console-bench-python-sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for aliyun-console-bench-python-sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ed4300ea010f3a926e75cc31cd740f6965a6a22ebf94d2564ce824703d279cfd
MD5 b66ff13440cdfccea5031e0d8f6dc517
BLAKE2b-256 90a8c2aba20bbd141f0c45f0e78ef89ed3dcd1684a036ac7e3f38700a7ff9459

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page