1.1 云服务器

  1、腾讯云SDK使用举例

       网址:https://cloud.tencent.com/document/sdk/Python

#! /usr/bin/env python
# -*- coding: utf-8 -*-
from tencentcloud.common import credential
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
# 导入对应产品模块的client models。
from tencentcloud.cvm.v20170312 import cvm_client, models

secretId = "*********************************"
secretKey = "*********************************"
try:
    # 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey
    cred = credential.Credential(secretId=secretId, secretKey=secretKey)

    # 实例化要请求产品(以cvm为例)的client对象
    client = cvm_client.CvmClient(cred, "ap-shanghai")     # 以查询可用区接口为例

    # 实例化一个请求对象
    req = models.DescribeZonesRequest()


    # 通过client对象调用想要访问的接口,需要传入请求对象
    resp = client.DescribeZones(req)
    # 输出json格式的字符串回包
    print '##########################'
    print resp.to_json_string()

except TencentCloudSDKException as err:
    print(err)

    
ret = {
    "TotalCount": 5,
    "ZoneSet": [{
        "ZoneState": "UNAVAILABLE",
        "ZoneName": "上海一区",
        "Zone": "ap-shanghai-1",
        "ZoneId": "200001"
    }, {
        "ZoneState": "AVAILABLE",
        "ZoneName": "上海二区",
        "Zone": "ap-shanghai-2",
        "ZoneId": "200002"
    }, {
        "ZoneState": "AVAILABLE",
        "ZoneName": "上海三区",
        "Zone": "ap-shanghai-3",
        "ZoneId": "200003"
    }, {
        "ZoneState": "AVAILABLE",
        "ZoneName": "上海四区",
        "Zone": "ap-shanghai-4",
        "ZoneId": "200004"
    }, {
        "ZoneState": "UNAVAILABLE",
        "ZoneName": "上海五区",
        "Zone": "ap-shanghai-5",
        "ZoneId": "200005"
    }],
    "RequestId": "ebd821c7-ac5c-4dfd-8038-762346bd14d1"
}
腾讯云SDK使用举例

相关文章:

  • 2021-11-02
  • 2021-11-13
  • 2021-12-30
  • 2021-11-06
  • 2021-11-29
  • 2021-11-28
猜你喜欢
  • 2021-11-30
  • 2022-01-03
相关资源
相似解决方案