01: 腾讯云API

Posted xiaonq

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了01: 腾讯云API相关的知识,希望对你有一定的参考价值。

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使用举例

  2、地域相关接口

 

 

 

 

 

 

 

11111111111111111111

以上是关于01: 腾讯云API的主要内容,如果未能解决你的问题,请参考以下文章

活动公告Hackathon —— 腾讯云AI API接入迷你赛

腾讯云挂载磁盘

腾讯云COS Api版本(不使用sdk)工具类

Python操作腾讯云CVM

Python调用腾讯API进行人脸身份证比对

新品速递:腾讯云 API 网关产品发布