CINXE.COM

<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"/><meta charSet="UTF-8"/><meta name="format-detection" content="telephone=no"/><meta name="applicable-device" content="pc,mobile"/><meta property="og:image" content="https://cloudcache.tencent-cloud.com/open_proj/proj_qcloud_v2/gateway/shareicons/cloud.png"/><title data-react-helmet="true">Python-SDK 中心-腾讯云</title><meta data-react-helmet="true" name="keywords" content="云API SDK"/><meta data-react-helmet="true" name="description" content="简介"/><link rel="icon" href="//cloudcache.tencent-cloud.com/qcloud/favicon.ico" type="image/x-icon"/><script> document.domain = 'cloud.tencent.com' </script><link rel="stylesheet" href="//cloudcache.tencent-cloud.com/qcloud/ui/gateway/portal/css/global-202307041440.css?max_age=31536000&amp;t=20191128"/><link rel="stylesheet" href="//cloudcache.tencent-cloud.com/open_proj/proj_qcloud_v2/gateway/portal/css/global-components.css?max_age=31536000&amp;t=20180817"/><link data-react-helmet="true" rel="canonical" href="https://cloud.tencent.com/document/sdk/Python"/><link data-react-helmet="true" rel="stylesheet" href="//cloudcache.tencent-cloud.com/qcloud/ui/gateway/documentation/documentation-v4/css/pandect-202209201611.css"/><link data-react-helmet="true" rel="stylesheet" href="//cloudcache.tencent-cloud.com/open_proj/proj_qcloud_v2/gateway/documentation/documentation-v4/css/import-2-markdown-20219091610.css"/><link data-react-helmet="true" rel="stylesheet" href="//cloudcache.tencent-cloud.com/qcloud/ui/platform/documents/css/documents-202410121102.css"/><link data-react-helmet="true" id="J-qcd-sdk-link" rel="stylesheet" href="//qcloudimg.tencent-cloud.cn/static/document/tea-slate-sdk.v0.1.16-fix-v5.css"/><link data-react-helmet="true" rel="stylesheet" href="//cloudcache.tencent-cloud.com/qcloud/main/components/document-feedback/document-feedback.1067f5e58e.css"/><style data-react-helmet="true"> /* 新版导航与底部在详情页上的特殊处理,在需要处理的页面 body 元素上加上 fix-jssdk start */ @media screen and (max-width: 1240px) and (min-width: 769px) { .fix-jssdk .pls-m-nav { height: 56px; } .fix-jssdk .pls-m-nav-bar { position: fixed; left: 0; top: 0; right: 0; } } @media screen and (max-width: 1000px) and (min-width: 769px) { .fix-jssdk .pls-footer-visible-m { display: none !important; } } /* 新版导航与底部在详情页上的特殊处理 end */ .no-translate-tips { height: 72px; background: #F6FCFF; padding: 0 20px; font-size: 14px; color: #333; position: relative; display: flex; align-items: center; justify-content: space-between; border: 1px solid #00A4FF; margin: 20px 0 -2px; z-index: 100; } .no-translate-tips.fixed-top { border: none; margin: 0; } .no-translate-tips .close { cursor: pointer; } @media screen and (max-width: 768px) { .no-translate-tips { padding: 0 16px; } } </style><link rel="stylesheet" href="https://cloudcache.tencent-cloud.com/qcloud/doc/styles/document/app.e924a617.css"/><script src="https://tam.cdn-go.cn/aegis-sdk/latest/aegis.min.js"></script><script> if (window.Aegis) { var aegis = window.aegisIns = new Aegis({ id: "dWOw9fv7jg4XmVzQ09", pagePerformance: true, onError: true, ext1: 's4jE-q267I', pagePerformance: true, reportAssetSpeed: true, reportApiSpeed: true, beforeRequest: function (data) { // 过滤掉一些明确上报 var ignoreKeys = [ 'Script error', 'chrome-extension', 'qq.com', 'queryWeappQrcodeStatus', 'login/ajax/info', 'woa.com', 'trafficCollect.php', 'google', 'dscache', 'act-api', 'set_qc_cookie', 'opc.cloud.tencent.com', 'uc_gre_ad_buss', 'eb.xcj.pub' ]; var alarmMsg = [data.logs.url, data.logs.msg].join('|'); for (var i=0; i<ignoreKeys.length; i++) { if (alarmMsg.indexOf(ignoreKeys[i]) != -1) return false; } // 过滤掉爬虫和开发者工具环境 if (/bot|wechatdevtools|spider/i.test(navigator.userAgent)) { return false; } // 过滤掉堆栈里无js文件的 if (data.logs.level === '4' && data.logs.msg && data.logs.msg.indexOf('.js') === -1) { return false; } } }) } </script></head><body class="documents-details color-bg fix-jssdk"><div id="no-global-if-no-need"> <script> var shouldHideGlobalComponent = window !== top && /^cloud\.tencent\.(com|cn|com\.cn)$/.test(top.document.domain) && top.DisableIFrameOfficialHeaderAndFooter; if (shouldHideGlobalComponent) { var head = document.getElementsByTagName('head')[0]; var hideStyles = n="#navigationBar,#navigationBarM,#qcportal-kit-footer,.c-hero-bar,.J-qc-footer,.J-subHeader,.J-docSidebarSearch{display:none!important}@media only screen and (max-width: 768px){.doc-box .table-box {padding-top:20px!important}.c-hero-bar-tit {margin-top:10px}}.doc-aside{padding-top:18px!important}.doc-con.J-mainDetail{padding-top:16px}.documents-container {overflow-x: hidden !important;}.documents-details .rno-column-layout-aside {top: 57px !important;}.J-detailLayout {padding-top: 0 !important;}.J-docHead {top: 0 !important;position: relative !important;}.J-docHead .topbar-guide-nav {top: 0 !important;}"; var linkElement = document.createElement('link'); linkElement.setAttribute('rel', 'stylesheet'); linkElement.setAttribute('type', 'text/css'); linkElement.setAttribute('href', 'data:text/css;charset=UTF-8,' + encodeURIComponent(hideStyles)); head.appendChild(linkElement); } </script> </div><div><link id="qcportal-kit-style" rel="stylesheet" href="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/full.f344ca603e99f2a3ac3a.css"></div><div><div id="qcportal-kit-topnav"><div role="navigation" id="navigationBar" data-type="cn_zh" class="pls-nav fixed"><div class="pls-nav-mod"><div class="pls-nav-top"><a class="pls-nav-top-logo" href="https://cloud.tencent.com" hotrep="hp.header.hp"><i>腾讯云</i></a><div class="pls-nav-list-wrap"><ul class="pls-nav-list"><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.act" href="https://cloud.tencent.com/act">最新活动<i class="pls-nav-tag hot"><span class="pls-nav-tag-text">HOT</span></i></a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.product" href="https://cloud.tencent.com/product">产品</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.solution" href="https://cloud.tencent.com/solution">解决方案</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.price" href="https://buy.cloud.tencent.com/pricing">定价</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.ecenter" href="https://cloud.tencent.com/act/pro/center">企业中心</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.market" href="https://market.cloud.tencent.com">云市场</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.developer" href="https://cloud.tencent.com/landing/developer-ecology">开发者</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.support" href="https://cloud.tencent.com/act/event/service-support">客户支持</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.cooperate" href="https://cloud.tencent.com/landing/partner-ecology">合作与生态</a></li><li class="pls-nav-item" tabindex="-1"><a role="button" hotrep="hp.header.learn" href="https://cloud.tencent.com/about">了解腾讯云</a></li></ul></div><div class="pls-nav-top-operation"></div></div><section class="pls-nav-dropdown" style="visibility:hidden;height:0"><div style="height:0;transition:transform ease-in-out .2s, opacity ease-in-out .2s;opacity:0;transform:translate(0, -100%)"><a class="pls-nav-dropdown-close" hotrep="hp.header.close">关闭</a></div></section></div></div> <div id="navigationBarM" class="pls-m-nav"><div class="pls-m-nav-bar"><div class="pls-m-nav-bar-main"><a href="https://cloud.tencent.com/" class="pls-m-nav-logo"></a></div><div class="pls-m-nav-bar-extra"><a class="pls-m-nav-btn" aria-label="搜索"><i class="pls-m-nav-btn-icon search"></i></a><a class="pls-m-nav-btn profile" aria-label="用户"><i class="pls-m-nav-btn-icon user"></i></a><a class="pls-m-nav-btn" aria-label="菜单"><i class="pls-m-nav-btn-icon menu"><span></span><span></span><span></span></i></a></div></div><div class="pls-m-nav-dropdown search" style="display:none"><div class="pls-m-nav-search"><div class="pls-m-nav-search-bar"><input type="text" class="pls-m-nav-search-input" placeholder="请输入搜索的关键词" value=""/><a class="pls-m-nav-search-btn">搜索</a></div></div></div></div></div></div><div id="react-root" aegis-first-screen-timing="true"><div class="J-mainContent responsible documents-container" style="background-color:#fff"><div class="rno-column-layout J-pc-wrap"><div class="J-body-wrap layout-columns" style="position:relative"><div class="rno-column-layout-cont J-layoutCont rno-details-compact"><div class="J-docDetailSide rno-column-layout-aside" style="top:97px;transform:"><div class="rno-column-layout-aside-inner"><div class="rno-column-aside-hd-2 J-docDetailSideTit" style="margin-top:38px"><a href="/document/sdk" data-bypass-xhr="true" class="rno-column-aside-title-2">SDK 中心</a><i class="rno-column-aside-menu-fold-2 J-productNavCollapseTrigger active"></i></div><div class="rno-column-aside-bd-2 doc-aside-wrap J-sideScrollArea J-sideNavInnerBoxPc"></div></div></div><div class="rno-document-details-layout rno-document-head-topbar-layout J-detailLayout rno-toc-layout" style="margin-top:"><div class="rno-document-head J-docHead" style="left:auto;top:60px"><div class="topbar-guide-nav" style="position:fixed;width:100%;left:0;top:60px"><div class="topbar-guide-inner"><ul class="topbar-guide-link"><li><a hotrep="doc.topsearch.product" href="https://cloud.tencent.com/document/product">文档中心</a></li> <li><a hotrep="doc.topsearch.guide" href="https://cloud.tencent.com/guide">入门中心</a></li> <li><a hotrep="doc.topsearch.api" href="https://cloud.tencent.com/document/api">API 中心</a></li> <li><a hotrep="doc.topsearch.sdk" href="https://cloud.tencent.com/document/sdk">SDK 中心</a></li> <li><a hotrep="doc.topsearch.doc-center" class="J-myFeedback">我的反馈</a></li></ul></div></div></div><div class="rno-document-details-wrap"><div style="display:none"><div class="rno-search-mobile-bar J-subHeader"><a class="rno-search-mobile-menu J-phoneMenu"><i class="rno-search-mobile-menu-icon"></i></a><div class="rno-search-mobile-inner"><div class="doc-search-title-m J-docSubHeaderTitle"><span class="doc-search-title">SDK 中心</span></div></div></div></div><div class="rno-document-details-cont J-mainDetail"><div style="padding:0"><div class="J-innerMain" data-hastoc="1"><div class="rno-header-crumbs-2"><div class="rno-header-crumbs-inner-2"><a href="/document/product" title="文档中心" data-bypass-xhr="true" hotrep="document.article.breadcrumb" class="rno-header-crumbs-link-2">文档中心</a><i class="rno-header-crumbs-icon-2">&gt;</i><a href="/document/sdk" title="SDK 中心" hotrep="document.article.breadcrumb" class="rno-header-crumbs-link-2">SDK 中心</a><i class="rno-header-crumbs-icon-2">&gt;</i><span class="rno-header-crumbs-link-2 active">Python</span></div></div><div class="J-markdown-box"><div class="rno-title-module J-mainTitle"><h1 class="rno-title-module-title">Python</h1><div class="rno-title-module-body"><p class="rno-title-module-date">最近更新时间:<!-- -->2023-10-19 10:34:31</p><div class="rno-title-module-operate"><a class="rno-title-module-btn J-download-pdf" href="https://main.qcloudimg.com/raw/document/product/pdf/494_7244_cn.pdf" target="_blank" hotrep="document.article.pdf"><i class="rno-title-module-pdf"></i></a><div class="J-docShareModal rno-title-module-btn share com-share-bubble-trigger c-triangle-align-start com-share-pc m-hidden" hotrep="document.share"><a class="J-docShareToggleBtn com-share-bubble-trigger-link com-opt-link" style="cursor:pointer"><i class="rno-title-module-share"></i></a><div class="c-bubble c-bubble-top com-share-bubble"><div class="c-bubble-inner"><ul class="com-share-bubble-opts"><li><span class="com-share-bubble-text"><i class="com-share-bubble-icon wechat"></i><span>微信扫一扫</span></span><div class="J-docShareQRCodeContainer com-share-bubble-code"><img src=""/></div></li><li><a class="J-docShareLink com-share-bubble-link" data-sharetype="qq" target="_blank" hotrep="document.share.qq" style="cursor:pointer"><i class="com-share-bubble-icon qq"></i><span>QQ</span></a></li><li><a class="J-docShareLink com-share-bubble-link" data-sharetype="weibo" target="_blank" hotrep="document.share.weibo" style="cursor:pointer"><i class="com-share-bubble-icon weibo"></i><span>新浪微博</span></a></li><li><div class="J-docShareCopyTipModal com-share-bubble-trigger"><a class="J-docShareCopySiteBtn com-share-bubble-link" style="cursor:pointer"><i class="com-share-bubble-icon link"></i><span>复制链接</span></a><div class="com-share-bubble c-bubble c-bubble-top com-share-bubble-msg"><div class="c-bubble-inner"><i class="icon"></i>链接复制成功</div></div></div></li></ul></div></div></div><a class="J-docFavoriteActBtn rno-title-module-btn" style="cursor:pointer"><i class="rno-title-module-fav"></i></a><a class="rno-title-module-btn fav J-myCollection" target="_blank"><span class="rno-title-module-text"><em>我的收藏</em></span></a></div></div></div><div class="rno-document-details-side"><div class="markdown-nav J-navContainer absolute" style="margin-left:0;top:179px"><h2 class="nav-title">本页目录:</h2><ul class="markdown-nav-list J-floatCategory"><li><a href="#88cf3ad2-31f8-4fe9-a115-02604f377e7a" title="简介">简介</a></li><li><a href="#2268f3b7-f63b-4990-ae36-18686c6de852" title="依赖环境">依赖环境</a><ul class="tea-slate-sdk-toc-list no-border"><li><a href="#56f4aa4e-c789-49b3-b904-2afdd479e717" title="依赖问题">依赖问题</a></li></ul></li><li><a href="#024781ac-2df6-414a-90e7-603c7b836ef9" title="获取安装">获取安装</a><ul class="tea-slate-sdk-toc-list no-border"><li><a href="#7cffce86-29eb-4ff5-8831-6c694063f1fe" title="通过 Pip 安装(推荐)">通过 Pip 安装(推荐)</a></li><li><a href="#2530a5a0-e470-41de-9697-41cf697aec4d" title="通过源码包安装">通过源码包安装</a></li></ul></li><li><a href="#520e488f-a082-4a4e-89c3-e57708be1935" title="示例">示例</a><ul class="tea-slate-sdk-toc-list no-border"><li><a href="#344fc147-8775-4af3-ba4b-d30d5c26b6ac" title="简化版">简化版</a></li><li><a href="#3cd4d4b2-ef47-4d62-8afc-17e73c8479fe" title="详细版">详细版</a></li><li><a href="#a087c265-1a9a-4c9c-bd77-3b73a3a253a2" title="Common Client 调用方式">Common Client 调用方式</a></li><li><a href="#022ce35b-0b79-44f1-adeb-480298b31479" title="更多示例">更多示例</a></li></ul></li><li><a href="#f3f3a693-fd27-410d-9a83-528339a9f4b6" title="相关配置">相关配置</a><ul class="tea-slate-sdk-toc-list no-border"><li><a href="#f66dbfbc-2f08-4853-af45-6057db873bf4" title="代理">代理</a></li><li><a href="#f027b118-559e-474b-bb48-f5490002c9a4" title="证书问题">证书问题</a></li></ul></li><li><a href="#6d1c6674-37d1-431c-908b-2e27bec41331" title="凭证管理">凭证管理</a></li></ul></div></div><div id="docArticleContent" class="doc-article-content"><div id="doc-slate-root"><div class="tea-editable rich-editable tse-editable" data-tslate-sdk-version="0.0.30" data-slate-editor="true" data-slate-node="value" contenteditable="false" zindex="-1" style="position:relative;outline:none;white-space:pre-wrap;word-wrap:break-word"><div class="anchor-element"><h2 data-slate-node="element" class="" id="88cf3ad2-31f8-4fe9-a115-02604f377e7a"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">简介</span></span></span></h2></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">欢迎使用腾讯云开发者工具套件(SDK)3.0,SDK 3.0是云 API 3.0平台的配套工具。目前已经支持云服务器 CVM、私有网络 VPC、云硬盘 CBS 等产品,将来会支持更多云服务产品。新版 SDK 实现了统一化,具有各个语言版本的 SDK 使用方法相同、接口调用方式相同,统一的错误码和返回包格式等优点。 为方便 Python 开发者调试和接入腾讯云产品 API,本文向您介绍适用于 Python 的腾讯云开发工具包,提供了简单示例来帮助您快速获取腾讯云 Python SDK 并开始调用。</span></span></span></div><div class="anchor-element"><h2 data-slate-node="element" class="" id="2268f3b7-f63b-4990-ae36-18686c6de852"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">依赖环境</span></span></span></h2></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">1.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">支持的版本:Python 2.7,3.6-3.9</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">2.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">从 </span></span></span><a class="ref" href="https://console.cloud.tencent.com/" target="_blank" data-slate-node="element" data-slate-inline="true"><span contenteditable="false"></span><span class="content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云控制台</span></span></span></span><span contenteditable="false"></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 开通相应产品。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">3.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">获取 SecretID、SecretKey 以及调用地址(endpoint)。云 API 密钥 SecretId 和 SecretKey 请前往 </span></span></span><a class="ref" href="https://console.cloud.tencent.com/cam/capi" title="https://console.cloud.tencent.com/cam/capi" target="_blank" data-slate-node="element" data-slate-inline="true"><span contenteditable="false"></span><span class="content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">API 密钥管理</span></span></span></span><span contenteditable="false"></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 获取。endpoint 一般形式为 *.tencentcloudapi.com,例如云服务器 CVM 的调用地址为 cvm.tencentcloudapi.com,详情请参见各产品的说明文档。</span></span></span></span></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="56f4aa4e-c789-49b3-b904-2afdd479e717"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">依赖问题</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">本项目依赖 requests 库,由于 requests 库2.30.0及以上的版本适配了 urllib 3 2.0版本,如果您在使用 SDK 时遇到以下错误:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the &#x27;ssl&#x27; module is compiled with &#x27;OpenSSL 1.0.x&#x27;</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">您可以尝试以下解决方法:</span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">将 urllib3的版本降低到1.26.x版本(requests 库的依赖版本在1.21.1到3之间)。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">使用 OpenSSL 1.1.1+版本,重新编译 Python 环境。</span></span></span></span></div><div class="anchor-element"><h2 data-slate-node="element" class="" id="024781ac-2df6-414a-90e7-603c7b836ef9"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">获取安装</span></span></span></h2></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">在安装 Python SDK 之前,请先获取安全凭证。在首次使用云 API 之前,您需要在腾讯云控制台上申请安全凭证。安全凭证包括 SecretID 和 SecretKey。SecretID 用于标识 API 调用者的身份,SecretKey 用于加密签名字符串和服务器端验证签名字符串。请严格保管 SecretKey,避免泄露。</span></span></span></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="7cffce86-29eb-4ff5-8831-6c694063f1fe"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">通过 Pip 安装(推荐)</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">您可以使用 pip 安装方式将腾讯云 API Python SDK 安装到您的项目中。如果您的项目环境尚未安装 pip,请参见 </span></span></span><a class="ref" href="https://pip.pypa.io/en/stable/installation/" target="_blank" data-slate-node="element" data-slate-inline="true"><span contenteditable="false"></span><span class="content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">pip</span></span></span></span><span contenteditable="false"></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 官网安装。</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">执行以下命令在命令行中使用 pip 安装或更新腾讯云 API Python SDK:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-bash code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">pip </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token function"><span data-slate-string="true">install</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> --upgrade tencentcloud-sdk-python</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">中国大陆地区的用户可以使用国内镜像源以提高下载速度,例如:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">pip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python</span></code></span></span></div></pre></div></div><div class="tse-hint alert" data-slate-node="element"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><b><span style="color:#04C8DC"><span data-slate-string="true">注意:</span></span></b></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">如果您的 Python 环境同时存在 Python2 和 Python3, Python3 环境需要使用 pip3 命令安装。</span></span></span></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">如果您只想使用某个具体产品的包,例如云服务器 CVM,可以单独安装该包。请注意,单独安装某个产品的包时,不能与总包同时工作。本文以安装云服务器 CVM 包为例,命令如下:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">pip install --upgrade tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm</span></code></span></span></div></pre></div></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="2530a5a0-e470-41de-9697-41cf697aec4d"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">通过源码包安装</span></span></span></h3></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">1.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">前往 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://github.com/tencentcloud/tencentcloud-sdk-python" title="https://github.com/tencentcloud/tencentcloud-sdk-python" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Github 仓库</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 或者 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://gitee.com/tencentcloud/tencentcloud-sdk-python" title="https://gitee.com/tencentcloud/tencentcloud-sdk-python" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Gitee 仓库</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 下载最新代码。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">2.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">解压下载的源码包。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">3.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">打开命令行终端,进入解压后的 tencentcloud-sdk-python 目录,执行以下命令来安装 SDK:</span></span></span></span></div><div data-slate-node="element" class="code-block-wrap tse-level-1"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-bash code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">$ </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token builtin"><span data-slate-string="true">cd</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud-sdk-python</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">$ python setup.py </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token function"><span data-slate-string="true">install</span></span></span></span></div></pre></div></div><div class="anchor-element"><h2 data-slate-node="element" class="" id="520e488f-a082-4a4e-89c3-e57708be1935"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">示例</span></span></span></h2></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">本文以云服务器 CVM 产品的 DescribeInstances 接口为例:</span></span></span></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="344fc147-8775-4af3-ba4b-d30d5c26b6ac"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">简化版</span></span></span></h3></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">exception</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">tencent_cloud_sdk_exception </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> TencentCloudSDKException</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">cvm</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">v20170312 </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> cvm_client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> models</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">try</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">:</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># cred = credential.Credential(&quot;secretId&quot;, &quot;secretKey&quot;)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">environ</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;TENCENTCLOUD_SECRET_ID&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">environ</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;TENCENTCLOUD_SECRET_KEY&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> client </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> cvm_client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">CvmClient</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">cred</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ap-shanghai&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> req </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> models</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DescribeInstancesRequest</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> resp </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DescribeInstances</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">req</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">print</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">resp</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">to_json_string</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">except</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> TencentCloudSDKException </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">as</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> err</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">:</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">print</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">err</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="3cd4d4b2-ef47-4d62-8afc-17e73c8479fe"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">详细版</span></span></span></h3></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># -*- coding: utf-8 -*-</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> sys</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> logging</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">exception</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">tencent_cloud_sdk_exception </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> TencentCloudSDKException</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 导入对应产品模块的client models。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">cvm</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">v20170312 </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> cvm_client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> models</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 导入可选配置类</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">profile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">client_profile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">profile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">http_profile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> HttpProfile</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">try</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">:</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># cred = credential.Credential(&quot;secretId&quot;, &quot;secretKey&quot;)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">environ</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;TENCENTCLOUD_SECRET_ID&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> os</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">environ</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;TENCENTCLOUD_SECRET_KEY&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;SecretId&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;SecretKey&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 实例化一个http选项,可选的,没有特殊需求可以跳过。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> HttpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 如果需要指定proxy访问接口,可以按照如下方式初始化hp</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># httpProfile = HttpProfile(proxy=&quot;http://用户名:密码@代理IP:代理端口&quot;)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">protocol </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;https&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 在外网互通的网络环境下支持http协议(默认是https协议),建议使用https协议</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">keepAlive </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token boolean"><span data-slate-string="true">True</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 状态保持,默认是False</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">reqMethod </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;GET&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># get请求(默认为post请求)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">reqTimeout </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">30</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 请求超时时间,单位为秒(默认60秒)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">endpoint </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;cvm.ap-shanghai.tencentcloudapi.com&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 指定接入地域域名(默认就近接入)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 实例化一个client选项,可选的,没有特殊需求可以跳过。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> clientProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">signMethod </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;TC3-HMAC-SHA256&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 指定签名算法</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">language </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;en-US&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 指定展示英文(默认为中文)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">httpProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> httpProfile</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 实例化要请求产品(以cvm为例)的client对象,clientProfile是可选的。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> client </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> cvm_client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">CvmClient</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">cred</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ap-shanghai&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 打印日志按照如下方式,也可以设置log_format,默认为 &#x27;%(asctime)s %(process)d %(filename)s L%(lineno)s %(levelname)s %(message)s&#x27;</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># client.set_stream_logger(stream=sys.stdout, level=logging.DEBUG)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># client.set_file_logger(file_path=&quot;/log&quot;, level=logging.DEBUG) 日志文件滚动输出,最多10个文件,单个文件最大512MB</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># client.set_default_logger() 去除所有log handler,默认不输出</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 实例化一个cvm实例信息查询请求对象,每个接口都会对应一个request对象。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> req </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> models</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DescribeInstancesRequest</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 填充请求参数,这里request对象的成员变量即对应接口的入参。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 您可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> respFilter </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> models</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Filter</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 创建Filter对象, 以zone的维度来查询cvm实例。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> respFilter</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Name </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;zone&quot;</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> respFilter</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Values </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">[</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ap-shanghai-1&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ap-shanghai-2&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">]</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> req</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">Filters </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">[</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">respFilter</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">]</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># Filters 是成员为Filter对象的列表</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># python sdk支持自定义header如 X-TC-TraceId、X-TC-Canary,可以按照如下方式指定,header必须是字典类型的</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> headers </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">{</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;X-TC-TraceId&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">:</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ffe0c072-8a5d-4e17-8887-a8a60252abca&quot;</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">}</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> req</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">headers </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> headers</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的,headers为可选参数。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> resp </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> client</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DescribeInstances</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">req</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 输出json格式的字符串回包</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">print</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">resp</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">to_json_string</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">indent</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">2</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 也可以取出单个值。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 您可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">print</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">resp</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">TotalCount</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">except</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> TencentCloudSDKException </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">as</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> err</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">:</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">print</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">err</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="a087c265-1a9a-4c9c-bd77-3b73a3a253a2"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Common Client 调用方式</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">从版本3.0.396开始,腾讯云 Python SDK 支持使用</span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">泛用型的 API 调用方式(Common Client) </span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">进行请求。您只需安装 tencentcloud-sdk-python-common 包,即可向任何产品发起调用。</span></span></span></div><div class="tse-hint alert" data-slate-node="element"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><b><span style="color:#04C8DC"><span data-slate-string="true">注意:</span></span></b></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">您必须明确了解您调用的接口所需的参数,否则可能会导致调用失败。</span></span></span></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Common Client 的示例请参见 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/common_client/describe_instances.py" title="https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/common_client/describe_instances.py" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">example</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">。</span></span></span></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="022ce35b-0b79-44f1-adeb-480298b31479"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">更多示例</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">您可以在 </span></span></span><a class="ref" href="https://github.com/tencentcloud/tencentcloud-sdk-python" target="_blank" data-slate-node="element" data-slate-inline="true"><span contenteditable="false"></span><span class="content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">GitHub</span></span></span></span><span contenteditable="false"></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 的 examples 目录下找到更详细的示例代码。</span></span></span></div><div class="anchor-element"><h2 data-slate-node="element" class="" id="f3f3a693-fd27-410d-9a83-528339a9f4b6"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">相关配置</span></span></span></h2></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="f66dbfbc-2f08-4853-af45-6057db873bf4"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">代理</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">如果您在使用有代理的环境下,可以通过以下两种方式设置代理:</span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">1.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">在初始化 HttpProfile 时指定 proxy。您可以参考 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/describe_zones.py" title="https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/describe_zones.py" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">example</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 来设置代理。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ol"><span contenteditable="false" class="tse-markdown-ol-order">2.<!-- --> </span><span class="tse-markdown-ol-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">设置系统环境变量 </span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">https_proxy</span></code></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">如果未正确设置代理,可能会导致无法正常进行调用,并抛出连接超时的异常。</span></span></span></div><div class="anchor-element"><h3 data-slate-node="element" class="" id="f027b118-559e-474b-bb48-f5490002c9a4"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">证书问题</span></span></span></h3></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">在 Mac 操作系统安装 Python 3.6或更高版本时,可能会遇到证书错误。错误信息如下:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056).</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">这是因为在 Mac 操作系统下,Python 不再使用系统默认的证书,并且 Python 本身也不提供证书。在进行 HTTPS 请求时,需要使用 </span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">certifi</span></code></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 库提供的证书,但 SDK 不支持指定,因此只能通过执行以下命令来安装证书以解决此问题:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">sudo &quot;/Applications/Python 3.6/Install Certificates.command&quot;</span></code></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">对于 Python 2 版本,也可以使用类似的命令来解决类似的问题:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">sudo /Applications/Python 2.7/Install Certificates.command</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云 Python SDK 默认使用 certifi 库提供的证书。如果您需要指定其他证书,可以进行如下设置:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 指定证书</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">certification </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;/path/to/certification&quot;</span></span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">如果您想跳过证书校验,可以将参数设置为 False,进行如下设置:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 跳过证书校验</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">httpProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">certification </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token boolean"><span data-slate-string="true">False</span></span></span></span></div></pre></div></div><div class="anchor-element"><h2 data-slate-node="element" class="" id="6d1c6674-37d1-431c-908b-2e27bec41331"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">凭证管理</span></span></span></h2></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云 Python SDK 目前支持以下几种方式进行凭证管理:</span></span></span></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="ee67b052-8a89-437a-a4d7-aded2b102f7b"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">环境变量</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">默认情况下,SDK 会读取环境变量 </span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">TENCENTCLOUD_SECRET_ID</span></code></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 和 </span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">TENCENTCLOUD_SECRET_KEY</span></code></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 获取 SecretId 和 SecretKey。您可以使用以下代码获取凭证:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">EnvironmentVariableCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="2da4da5d-9fb5-48d3-ad2f-7de011216b35"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">配置文件</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> SDK 支持读取配置文件中的凭证信息。配置文件的路径要求如下:</span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Windows:</span></span></span></span></div><div data-slate-node="element" class="code-block-wrap tse-level-1"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">c:\\Users\\NAME\\.tencentcloud\\credentials</span></code></span></span></div></pre></div></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">Linux:</span></span></span></span></div><div data-slate-node="element" class="code-block-wrap tse-level-1"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-plaintext code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">~/.tencentcloud/credentials</span></code></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> 或 </span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><code><span data-slate-string="true">/etc/tencentcloud/credentials</span></code></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">配置文件的格式为 .ini 格式,示例如下:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-ini code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">[default]</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">secret_id = xxxxx</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">secret_key = xxxxx</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">您可以使用以下代码获取凭证:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">ProfileCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="53a627f2-ecf6-4f66-8828-5e763f6edb65"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">角色扮演</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">有关角色扮演的相关概念请参见 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://cloud.tencent.com/document/product/598/19420" title="https://cloud.tencent.com/document/product/598/19420" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云角色概述</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">。如果使用此种方式,您需要在腾讯云访问管理控制台上创建一个角色,具体创建过程请参见 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://cloud.tencent.com/document/product/598/19381" title="https://cloud.tencent.com/document/product/598/19381" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云角色创建</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">。</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">在您拥有角色后,您可以使用以下代码获取临时凭证:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">STSAssumeRoleCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;SecretId&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;SecretKey&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;RoleArn&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;RoleSessionName&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="20c6c21d-afe9-4f52-bb54-bd57efa8f2d8"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">实例角色</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">有关实例角色的相关概念请参见 </span></span></span><a data-slate-node="element" data-slate-inline="true" class="" href="https://cloud.tencent.com/document/product/213/47668" title="https://cloud.tencent.com/document/product/213/47668" target="_blank"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云实例角色</span></span></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">。</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">在您为实例绑定角色后,您可以在实例中访问相关元数据接口获取临时凭证,SDK 会自动刷新临时凭证。相关代码如下:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">CVMRoleCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="7175f509-7226-4645-a3a5-1db69d05ed44"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">凭证提供链</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">腾讯云 Python SDK 提供了凭证提供链,它会按照</span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">环境变量 &gt; 配置文件 &gt; 实例角色 &gt; TKE OIDC 凭证</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">的顺序尝试获取凭证,并返回第一个获取到的凭证。相关代码如下:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用默认凭证提供链</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DefaultCredentialProvider</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用环境变量</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">EnvironmentVariableCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用配置文件</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">ProfileCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用实例角色</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">CVMRoleCredential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用TKE OIDC凭证</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">cred </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">DefaultTkeOIDCRoleArnProvider</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">get_credential</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">具体示例代码可以参考 </span></span></span><a class="ref" href="https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/credential_providers.py" target="_blank" data-slate-node="element" data-slate-inline="true"><span contenteditable="false"></span><span class="content"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">credential_providers.py </span></span></span></span><span contenteditable="false"></span></a><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">中的示例。</span></span></span></div><div class="anchor-element"><h4 data-slate-node="element" class="" id="663b0cd3-63de-4392-a4b5-aff29284e681"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">地域容灾</span></span></span></h4></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">从版本v3.0.923开始,腾讯云 Python SDK 支持地域容灾功能。当某个域名请求失败时,SDK 会自动切换到容灾域名。使用方式如下:</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">使用地域容灾功能时,有三种状态相互转换:</span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">关闭、全开</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">和</span></span></span><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">半开</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">状态。</span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">关闭状态</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">:使用主要域名进行请求,如果出现错误,则会切换到全开状态。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">全开状态</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">:使用容灾域名进行请求。当达到一定时间时,会切换到半开状态。</span></span></span></span></div><div data-slate-node="element" class="tse-markdown-ul"><span contenteditable="false" class="tse-ul-symbol"></span><span class="tse-ul-content"><span data-slate-node="text"><span data-slate-leaf="true"><b><span data-slate-string="true">半开状态</span></b></span></span><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">:此时会将少量请求发送到主要域名,如果请求失败,则切换到全开状态。当请求成功数达到一定数量时,会切换到关闭状态。</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">以下是相关设置示例:</span></span></span></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 简单开启方式,此时所有的配置都是默认值</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">profile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">client_profile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">clientProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">disable_region_breaker </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token boolean"><span data-slate-string="true">False</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># False表示使用地域容灾</span></span></span></span></div></pre></div></div><div data-slate-node="element" class="code-block-wrap"><div contenteditable="false" class="code-block-toolbar"><div class="code-block-toolbar__item"><div class="code-block-toolbar__btn"><div class="code-block-toolbar__icon"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z" fill-rule="evenodd" clip-rule="evenodd"></path></svg></div></div></div></div><div><pre class="language-python code-block"><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 自定义配置</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">from</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> tencentcloud</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">common</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">profile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">client_profile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token keyword"><span data-slate-string="true">import</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> RegionBreakerProfile</span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">regionBreakerProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> RegionBreakerProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> backup_endpoint</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token string"><span data-slate-string="true">&quot;ap-beijing.tencentcloudapi.com&quot;</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 备用地域,格式${region}.tencentcloudapi.com,必须是存在的域名,默认值为ap-guangzhou.tencentcloudapi.com</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> max_fail_num</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">3</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 最大失败数,默认值5</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> max_fail_percent</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">0.5</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 最大失败率,默认值0.75。当失败数达到最大失败数,且失败率达到最大的失败率时,或者连续失败数达到5次,关闭状态切换到开启状态</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> window_interval</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">60</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 计数窗口,单位s,默认300。处于关闭状态时,时间超过窗口则重新计数</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> timeout</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">30</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">,</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 全开时间,单位s,默认60。处于全开状态达到超过该时间,切换为半开状态</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true"> max_requests</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token number"><span data-slate-string="true">3</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 最大成功请求数,默认5。处于半开状态时,请求主域名达到该数量则切换为关闭状态</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">clientProfile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> ClientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">(</span></span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">)</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">disable_region_breaker </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token boolean"><span data-slate-string="true">False</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token comment"><span data-slate-string="true"># 使用地域容灾必须要将这个值置为false</span></span></span></span></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-string="true">clientProfile</span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token punctuation"><span data-slate-string="true">.</span></span></span><span data-slate-leaf="true"><span data-slate-string="true">region_breaker_profile </span></span><span data-slate-leaf="true"><span data-slate-leaf="true" class="prism-token token operator"><span data-slate-string="true">=</span></span></span><span data-slate-leaf="true"><span data-slate-string="true"> regionBreakerProfile</span></span></span></div></pre></div></div><div class="" data-slate-node="element"><span data-slate-node="text"><span data-slate-leaf="true"><span data-slate-zero-width="n" data-slate-length="0"><br/></span></span></span></div></div></div></div><script type="text/template" id="codeTemplate" data-type="code"> <div class="rno-code-wrap"> <div class="rno-code J-markdownCode"> <div class="rno-code-hd"> <ul class="rno-code-tab J-language"> <!--展示语言列表--> </ul> </div> <div class="rno-code-bd markdown-code-bd J-codeBox"> <div class="rno-code-toolbars J-codeToolbar"> <a data-bypass-xhr="1" class="rno-code-toolbars-copy J-copyContent"></a> <div class="code-dropdown code-dropdown-align-center J-copy-tips"> <div class="code-dropdown-inner"> <div class="code-dropdown-text">复制</div> </div> </div> <div class="code-dropdown code-dropdown-align-center J-copy-success"> <div class="code-dropdown-inner"> <div class="code-dropdown-text">复制成功</div> </div> </div> </div> </div> </div> </div> </script></div><div class="doc-pages J-docDetailPagination"><a href="/document/sdk/PHP" class="prev J-docDetailPaginationPage" hotrep="document.detail.previous" title="上一篇: PHP">上一篇<!-- -->: <!-- -->PHP</a><a href="/document/sdk/Java" class="next J-docDetailPaginationPage" hotrep="document.detail.next" title="下一篇: Java">下一篇<!-- -->: <!-- -->Java</a></div><div id="document-feedback-container" class="document-feedback-container"></div><div class="J-relatedArticleLayout" data-title="SDK 中心"></div><div class="J-featuredFeedbackLayout" style="margin-top:20px"></div></div></div></div></div></div></div></div></div></div><div id="J-viewLargeImageBox" data-mode="pc" class="zoom-mask" style="display:none;width:100%;height:100%"><div class="zoom-close"></div><div class="zoom-wrap"><img/></div></div><div class="qcc-footer-s footer-pc J-qc-footer" data-type="cn_zh"><div class="c-footer-inner"><div class="c-footer-blogroll-main"><nav class="c-footer-blogroll-links copyright"><span class="slide">Copyright © 2013<!-- -->-2024<!-- --> Tencent Cloud. All Rights Reserved.<span> 腾讯云 版权所有</span></span><br/><a href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802020287" target="_blank" hotrep="hp.footer.bottom.beian" class="slide slide-ct">京公网安备 11010802017518</a><a href="http://beian.miit.gov.cn" target="_blank" hotrep="hp.footer.bottom.miitbeian" class="slide slide-ct">粤B2-20090059-1</a></nav></div><div class="c-footer-blogroll-extra"><div class="c-footer-select J-qcRegionSelector"><a class="c-footer-select-trigger J-qcRegionTrigger"><i class="icon"></i>中国站</a><div class="c-footer-dropdown J-qcFooterRegionList"><ul class="c-footer-dropdown-menu"><li class="actived"><a class="J-qcRegionOption" data-region="cn_zh" hotrep="hp.footer.region.cn">中文</a></li><li><a class="J-qcRegionOption" data-region="intl" href="https://www.tencentcloud.com/">International</a></li></ul></div></div></div></div></div><div class="qc-scrollbar rno-scrollbar-tools rno-documents-tools J-qc-scrollbar"><div class="qc-scrollbar-inner rno-scrollbar-tools-inner"><div class="qc-scrollbar-item qc-scrollbar-document rno-scrollbar-tools-item rno-scrollbar-tools-document rno-scrollbar-tools-service gift-mod"><div class="qc-scrollbar-button qc-scrollbar-toggle is-active rno-scrollbar-tools-button rno-scrollbar-tools-toggle rno-documents-tools-gift hover J-btnDocFeedback" hotrep="hp.sidebar.document" style="border-color:#e1e8f0"><img class="rno-scrollbar-tools-icon" src="https://main.qcloudimg.com/raw/8cdc42f31161d060ae6c78e1acdcd562.svg" alt=""/><img class="rno-scrollbar-tools-icon-hover" src="https://main.qcloudimg.com/raw/30187ce8f5ed8903808e482cdca64b40.svg" alt=""/><span class="qc-scrollbar-button-desc rno-scrollbar-tools-button-desc">文档反馈</span></div><div class="c-bubble c-bubble-right J-guideTip" style="display:none"><div class="c-bubble-inner"><div class="bubble-icon"></div><div class="bubble-tit">鼠标选中内容,快速反馈问题</div><div class="bubble-text">选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。</div><div class="bubble-btns"><a class="bubble-link-left J-guideNotShowAgain">不再提示</a><a class="bubble-link-right J-guideKnown">好的,知道了</a></div></div></div></div><div class="qc-scrollbar-item qc-scrollbar-document rno-scrollbar-tools-item rno-scrollbar-tools-service rno-scrollbar-tools-document gift-mod J-gitMod"><div class="rno-scrollbar-tools-button rno-scrollbar-tools-toggle" hotrep="hp.sidebar.document" style="padding-top:12px;padding-bottom:12px;padding-left:0;padding-right:0;display:none"><img class="rno-scrollbar-tools-icon" src="https://main.qcloudimg.com/raw/07e6c1149bdbaa766dcd7c4e2b9a5886/gift-blue.svg" style="vertical-align:top" alt=""/></div><div class="rno-scrollbar-tools-button rno-scrollbar-tools-toggle rno-documents-tools-gift J-btnDocInvestigate" hotrep="hp.sidebar.document.act" style="background-color:#fff;border:"><img class="rno-scrollbar-tools-icon" src="https://main.qcloudimg.com/raw/07e6c1149bdbaa766dcd7c4e2b9a5886/gift-blue.svg" alt=""/><span class="qc-scrollbar-button-desc rno-scrollbar-tools-button-desc">文档活动</span></div><div class="J-hoverPanel" style="z-index:8;bottom:0;right:43px;padding-right:12px;position:absolute;display:none"><div class="rno-scrollbar-tools-bubble" style="position:static"><div class="rno-scrollbar-tools-bubble-inner"><div class="rno-scrollbar-tools-bubble-item"><a href="https://cloud.tencent.com/developer/article/1610407" hotrep="hp.sidebar.document.link1" target="_blank"><div class="rno-scrollbar-tools-bubble-head"><img class="rno-scrollbar-tools-bubble-icon" src="https://main.qcloudimg.com/raw/9674b05080ea616c61aabd5c9f7e7e0e.svg" alt=""/><img class="rno-scrollbar-tools-bubble-icon-hover" src="https://main.qcloudimg.com/raw/fe4d466f3ec44efd1ae62b6eee8c0b5f.svg" alt=""/><span class="rno-scrollbar-tools-bubble-title">文档“捉虫”活动</span></div><div class="rno-scrollbar-tools-bubble-desc">检视指定产品文档,发现和反馈有效问题,奖!</div></a></div><div class="rno-scrollbar-tools-bubble-item"><a href="https://cloud.tencent.com/developer/article/1630768" hotrep="hp.sidebar.document.link2" target="_blank"><div class="rno-scrollbar-tools-bubble-head"><img class="rno-scrollbar-tools-bubble-icon" src="https://main.qcloudimg.com/raw/bc8e0cd020e9b96a8e61319d2f145f15.svg" alt=""/><img class="rno-scrollbar-tools-bubble-icon-hover" src="https://main.qcloudimg.com/raw/d46e0544ea9b8962405e6b9febcbdaf5.svg" alt=""/><span class="rno-scrollbar-tools-bubble-title">API专项&quot;捉虫&quot;</span></div><div class="rno-scrollbar-tools-bubble-desc">反馈API文档问题,代金券、周边好礼奖不停!</div></a></div><div class="rno-scrollbar-tools-bubble-item"><a href="https://cloud.tencent.com/developer/article/1523112" hotrep="hp.sidebar.document.link3" target="_blank"><div class="rno-scrollbar-tools-bubble-head"><img class="rno-scrollbar-tools-bubble-icon" src="https://main.qcloudimg.com/raw/d5783f8d104e1d25a658df1685b087c2.svg" alt=""/><img class="rno-scrollbar-tools-bubble-icon-hover" src="https://main.qcloudimg.com/raw/bd063d4ae54dcf48a69edc3a822b26a9.svg" alt=""/><span class="rno-scrollbar-tools-bubble-title">文档建议,你提了吗</span></div><div class="rno-scrollbar-tools-bubble-desc">快来使用腾讯云产品文档,提出有效建议,奖!</div></a></div></div></div></div></div><div class="qc-scrollbar-item rno-scrollbar-tools-item rno-scrollbar-tools-service J-connectUsBlock"><a class="rno-scrollbar-tools-button rno-scrollbar-tools-toggle J-btnConnectUs" hotrep="hp.sidebar.connectus" title="联系我们" style="text-decoration:none"><img class="rno-scrollbar-tools-icon qc-scrollbar-icon" src="https://main.qcloudimg.com/raw/3bc4782fbfb8375d9a4e54e481298f82/message.svg" alt="message-icon"/><span class="rno-scrollbar-tools-button-desc qc-scrollbar-button-desc J-scrollbar-button-connect-us">联系我们</span></a><div class="J-expandPanel" style="z-index:6;bottom:0;right:43px;padding-right:12px;position:absolute;display:none"><div class="rno-scrollbar-tools-bubble" style="position:static"><div class="rno-scrollbar-tools-bubble-inner"><div class="rno-scrollbar-tools-bubble-item"><a class="J-presale-smartServiceLink" href="https://cloud.tencent.com/online-service?source=PRESALE&amp;from=connect-us" target="_blank"><div class="rno-scrollbar-tools-bubble-head"><img class="rno-scrollbar-tools-bubble-icon " src="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/images/pre-sales.44dccbb4.svg" alt="service-icon"/><img class="rno-scrollbar-tools-bubble-icon-hover" src="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/images/pre-sales-hover.9b27e3e9.svg" alt="service-hover-icon"/><span class="rno-scrollbar-tools-bubble-title">售前咨询</span></div><div class="rno-scrollbar-tools-bubble-desc">专属客户经理在线解答,提供专业的上云方案</div></a></div><div class="rno-scrollbar-tools-bubble-item"><a class="J-smartServiceLink" href="https://cloud.tencent.com/act/event/Online_service?from=connect-us" target="_blank"><div class="rno-scrollbar-tools-bubble-head"><img class="rno-scrollbar-tools-bubble-icon " src="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/images/message.ab26a8d5.svg" alt="service-icon"/><img class="rno-scrollbar-tools-bubble-icon-hover" src="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/images/message-hover.93a6b104.svg" alt="service-hover-icon"/><span class="rno-scrollbar-tools-bubble-title">售后支持</span></div><div class="rno-scrollbar-tools-bubble-desc">7*24获取专业工程师的帮助,快速解决您的问题</div></a></div><div class="rno-scrollbar-tools-bubble-item"><div class="rno-scrollbar-tools-bubble-more"><a class="J-connectUsLink" href="https://cloud.tencent.com/act/event/connect-service?from=connect-us" target="_blank">查看更多联系、反馈方式 &gt;</a></div></div></div></div></div><div class="rno-scrollbar-tools-bubble-m J-expandPanelM" style="z-index:6;top:-126px;right:4px;display:none;background:white"><div class="rno-scrollbar-tools-bubble-m-inner"><a class="rno-scrollbar-tools-bubble-m-item J-smartServiceLink" href="https://cloud.tencent.com/act/event/Online_service" target="_blank"><div class="rno-scrollbar-tools-bubble-m-head"><img class="rno-scrollbar-tools-bubble-icon-m" src="https://main.qcloudimg.com/raw/9c5843fbbc8e89caa61a727b76e50303/service.svg" alt=""/><span class="rno-scrollbar-tools-bubble-m-title">在线客服</span></div><div class="rno-scrollbar-tools-bubble-m-desc">智能诊断,即时回复</div></a><div class="rno-scrollbar-tools-bubble-m-item"><div class="rno-scrollbar-tools-bubble-m-more"><a href="https://cloud.tencent.com/act/event/connect-service" target="_blank">查看更多联系 &gt;</a></div></div></div></div></div><div class="rno-scrollbar-tools-item rno-scrollbar-tools-document rno-scrollbar-tools-service J-scrollbarTOC"><div class="rno-scrollbar-tools-button rno-scrollbar-tools-toggle rno-documents-tools-catalog" style="position:relative;margin-right:8px"><span class="rno-scrollbar-tools-button-desc">目录</span><div class="J-hoverPanel" style="position:absolute;z-index:6;bottom:42px;padding-bottom:8px;left:-1px;white-space:nowrap;text-align:left;display:none"><div class="rno-scrollbar-tools-bubble rno-scrollbar-toc-layer" style="position:static"><div class="rno-scrollbar-toc-wrap"><dl class="rno-scrollbar-toc-dl J-scrollbarTocList"></dl></div></div></div></div></div></div></div><a style="display:none" class="qc-back2top J-qc-back2top" title="返回顶部">返回顶部</a><script nonce="the-nonce">window.__staticRouterHydrationData = JSON.parse("{\"loaderData\":{\"0\":null,\"sdk\":{\"data\":{\"hotTips\":{\"activityName\":\"视频服务与安全产品捉虫活动邀您参加!\u003e\",\"link\":\"https://cloud.tencent.com/document/product/855/112110\",\"tipTag\":\"HOT\",\"enable\":true},\"meta\":{\"routebase\":\"/document\",\"module\":\"sdk\"},\"category\":{\"title\":\"SDK 中心\",\"url\":\"/document/sdk\",\"module\":\"sdk\"},\"sidebar\":{\"title\":\"SDK 中心\",\"entry\":\"/document/sdk\",\"catalogue\":{\"list\":[{\"id\":42698,\"title\":\"SDK 简介\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_42698_cn.pdf\",\"link\":\"/document/sdk/Description\",\"tag\":\"3.0\"},{\"id\":7243,\"title\":\"PHP\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_7243_cn.pdf\",\"link\":\"/document/sdk/PHP\",\"tag\":\"3.0\"},{\"id\":7244,\"title\":\"Python\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_7244_cn.pdf\",\"link\":\"/document/sdk/Python\",\"tag\":\"3.0\"},{\"id\":7245,\"title\":\"Java\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_7245_cn.pdf\",\"link\":\"/document/sdk/Java\",\"tag\":\"3.0\"},{\"id\":16615,\"title\":\"Go\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_16615_cn.pdf\",\"link\":\"/document/sdk/Go\",\"tag\":\"3.0\"},{\"id\":7246,\"title\":\".NET\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_7246_cn.pdf\",\"link\":\"/document/sdk/.NET\",\"tag\":\"3.0\"},{\"id\":7247,\"title\":\"Node.js\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_7247_cn.pdf\",\"link\":\"/document/sdk/Node.js\",\"tag\":\"3.0\"},{\"id\":41613,\"title\":\"C++\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_41613_cn.pdf\",\"link\":\"/document/sdk/C++\",\"tag\":\"3.0\"},{\"id\":52411,\"title\":\"Ruby\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_52411_cn.pdf\",\"link\":\"/document/sdk\",\"tag\":\"3.0\"},{\"id\":59901,\"title\":\"联系我们\",\"type\":\"page\",\"docType\":\"default\",\"pdfUrl\":\"https://main.qcloudimg.com/raw/document/product/pdf/494_59901_cn.pdf\",\"link\":\"/document/sdk\",\"tag\":\"3.0\"}],\"categoryId\":494,\"title\":\"SDK 中心\",\"lang\":\"zh\"},\"searchDisable\":true},\"navbar\":{\"title\":\"SDK 中心\",\"expandable\":false},\"plugins\":{},\"feedbackTags\":{\"1\":\"内容找不到\",\"2\":\"内容没更新\",\"3\":\"描述不清楚\",\"4\":\"步骤不完整\",\"5\":\"链接有错误\",\"6\":\"代码/图片缺失\",\"7\":\"找不到\",\"8\":\"不好用\",\"9\":\"看不懂\",\"10\":\"有错误\",\"11\":\"没更新\",\"12\":\"其他\"}},\"staticContext\":{\"isMobile\":false,\"isMiniProgram\":false,\"isWechat\":false,\"isPreview\":false,\"originalUrl\":\"/document/sdk/Python\",\"CDN_DOMAIN\":\"cloudcache.tencent-cloud.com\",\"QCLOUD_DOMAIN\":\"cloud.tencent.com\",\"isLegalReferer\":true,\"ssrInfo\":{},\"language\":\"zh\",\"requestId\":\"1TpQeYFiYo\"}},\"sdk-article\":{\"data\":{\"article\":{\"type\":\"page\",\"lang\":\"zh\",\"checkStatus\":1,\"categoryId\":494,\"content\":{\"disable\":false,\"disableTip\":\"\",\"title\":\"Python\",\"keywords\":\"云API SDK\",\"description\":\"简介\",\"docType\":\"default\",\"isGlossary\":false,\"body\":\"\u003cdiv class=\\\"tea-editable rich-editable tse-editable\\\" data-tslate-sdk-version=\\\"0.0.30\\\" data-slate-editor=\\\"true\\\" data-slate-node=\\\"value\\\" contenteditable=\\\"false\\\" zindex=\\\"-1\\\" style=\\\"position:relative;outline:none;white-space:pre-wrap;word-wrap:break-word\\\"\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"88cf3ad2-31f8-4fe9-a115-02604f377e7a\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e简介\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e欢迎使用腾讯云开发者工具套件(SDK)3.0,SDK 3.0是云 API 3.0平台的配套工具。目前已经支持云服务器 CVM、私有网络 VPC、云硬盘 CBS 等产品,将来会支持更多云服务产品。新版 SDK 实现了统一化,具有各个语言版本的 SDK 使用方法相同、接口调用方式相同,统一的错误码和返回包格式等优点。\\n为方便 Python 开发者调试和接入腾讯云产品 API,本文向您介绍适用于 Python 的腾讯云开发工具包,提供了简单示例来帮助您快速获取腾讯云 Python SDK 并开始调用。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"2268f3b7-f63b-4990-ae36-18686c6de852\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e依赖环境\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e1.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e支持的版本:Python 2.7,3.6-3.9\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e2.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e从 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca class=\\\"ref\\\" href=\\\"https://console.cloud.tencent.com/\\\" target=\\\"_blank\\\" data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\"\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云控制台\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 开通相应产品。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e3.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e获取 SecretID、SecretKey 以及调用地址(endpoint)。云 API 密钥 SecretId 和 SecretKey 请前往 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca class=\\\"ref\\\" href=\\\"https://console.cloud.tencent.com/cam/capi\\\" title=\\\"https://console.cloud.tencent.com/cam/capi\\\" target=\\\"_blank\\\" data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\"\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eAPI 密钥管理\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 获取。endpoint 一般形式为 *.tencentcloudapi.com,例如云服务器 CVM 的调用地址为 cvm.tencentcloudapi.com,详情请参见各产品的说明文档。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"56f4aa4e-c789-49b3-b904-2afdd479e717\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e依赖问题\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e本项目依赖 requests 库,由于 requests 库2.30.0及以上的版本适配了 urllib 3 2.0版本,如果您在使用 SDK 时遇到以下错误:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the \u0026#x27;ssl\u0026#x27; module is compiled with \u0026#x27;OpenSSL 1.0.x\u0026#x27;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e您可以尝试以下解决方法:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e将 urllib3的版本降低到1.26.x版本(requests 库的依赖版本在1.21.1到3之间)。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e使用 OpenSSL 1.1.1+版本,重新编译 Python 环境。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"024781ac-2df6-414a-90e7-603c7b836ef9\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e获取安装\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e在安装 Python SDK 之前,请先获取安全凭证。在首次使用云 API 之前,您需要在腾讯云控制台上申请安全凭证。安全凭证包括 SecretID 和 SecretKey。SecretID 用于标识 API 调用者的身份,SecretKey 用于加密签名字符串和服务器端验证签名字符串。请严格保管 SecretKey,避免泄露。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"7cffce86-29eb-4ff5-8831-6c694063f1fe\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e通过 Pip 安装(推荐)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e您可以使用 pip 安装方式将腾讯云 API Python SDK 安装到您的项目中。如果您的项目环境尚未安装 pip,请参见 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca class=\\\"ref\\\" href=\\\"https://pip.pypa.io/en/stable/installation/\\\" target=\\\"_blank\\\" data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\"\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003epip\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 官网安装。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e执行以下命令在命令行中使用 pip 安装或更新腾讯云 API Python SDK:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-bash code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003epip \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token function\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003einstall\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e --upgrade tencentcloud-sdk-python\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e中国大陆地区的用户可以使用国内镜像源以提高下载速度,例如:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003epip install -i https://mirrors.tencent.com/pypi/simple/ --upgrade tencentcloud-sdk-python\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"tse-hint alert\\\" data-slate-node=\\\"element\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan style=\\\"color:#04C8DC\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e注意:\u003c/span\u003e\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e如果您的 Python 环境同时存在 Python2 和 Python3, Python3 环境需要使用 pip3 命令安装。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e如果您只想使用某个具体产品的包,例如云服务器 CVM,可以单独安装该包。请注意,单独安装某个产品的包时,不能与总包同时工作。本文以安装云服务器 CVM 包为例,命令如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003epip install --upgrade tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"2530a5a0-e470-41de-9697-41cf697aec4d\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e通过源码包安装\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e1.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e前往 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://github.com/tencentcloud/tencentcloud-sdk-python\\\" title=\\\"https://github.com/tencentcloud/tencentcloud-sdk-python\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eGithub 仓库\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 或者 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://gitee.com/tencentcloud/tencentcloud-sdk-python\\\" title=\\\"https://gitee.com/tencentcloud/tencentcloud-sdk-python\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eGitee 仓库\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 下载最新代码。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e2.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e解压下载的源码包。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e3.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e打开命令行终端,进入解压后的 tencentcloud-sdk-python 目录,执行以下命令来安装 SDK:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap tse-level-1\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-bash code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e$ \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token builtin\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecd\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud-sdk-python\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e$ python setup.py \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token function\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003einstall\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"520e488f-a082-4a4e-89c3-e57708be1935\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e示例\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e本文以云服务器 CVM 产品的 DescribeInstances 接口为例:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"344fc147-8775-4af3-ba4b-d30d5c26b6ac\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e简化版\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexception\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003etencent_cloud_sdk_exception \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e TencentCloudSDKException\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecvm\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ev20170312 \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cvm_client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e models\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003etry\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# cred = credential.Credential(\u0026quot;secretId\u0026quot;, \u0026quot;secretKey\u0026quot;)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eenviron\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;TENCENTCLOUD_SECRET_ID\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eenviron\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;TENCENTCLOUD_SECRET_KEY\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e client \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cvm_client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCvmClient\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ap-shanghai\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e req \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e models\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDescribeInstancesRequest\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e resp \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDescribeInstances\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ereq\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprint\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eresp\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eto_json_string\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexcept\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e TencentCloudSDKException \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eas\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e err\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprint\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eerr\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"3cd4d4b2-ef47-4d62-8afc-17e73c8479fe\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e详细版\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# -*- coding: utf-8 -*-\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e sys\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e logging\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexception\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003etencent_cloud_sdk_exception \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e TencentCloudSDKException\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 导入对应产品模块的client models。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecvm\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ev20170312 \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cvm_client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e models\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 导入可选配置类\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprofile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclient_profile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprofile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ehttp_profile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e HttpProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003etry\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# cred = credential.Credential(\u0026quot;secretId\u0026quot;, \u0026quot;secretKey\u0026quot;)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eenviron\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;TENCENTCLOUD_SECRET_ID\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e os\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eenviron\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;TENCENTCLOUD_SECRET_KEY\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;SecretId\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;SecretKey\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 实例化一个http选项,可选的,没有特殊需求可以跳过。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e HttpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 如果需要指定proxy访问接口,可以按照如下方式初始化hp\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# httpProfile = HttpProfile(proxy=\u0026quot;http://用户名:密码@代理IP:代理端口\u0026quot;)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprotocol \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;https\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 在外网互通的网络环境下支持http协议(默认是https协议),建议使用https协议\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ekeepAlive \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token boolean\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eTrue\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 状态保持,默认是False\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ereqMethod \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;GET\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# get请求(默认为post请求)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ereqTimeout \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e30\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 请求超时时间,单位为秒(默认60秒)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eendpoint \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;cvm.ap-shanghai.tencentcloudapi.com\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 指定接入地域域名(默认就近接入)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 实例化一个client选项,可选的,没有特殊需求可以跳过。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e clientProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e clientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003esignMethod \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;TC3-HMAC-SHA256\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 指定签名算法\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e clientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003elanguage \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;en-US\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 指定展示英文(默认为中文)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e clientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ehttpProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e httpProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 实例化要请求产品(以cvm为例)的client对象,clientProfile是可选的。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e client \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e cvm_client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCvmClient\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ap-shanghai\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e clientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 打印日志按照如下方式,也可以设置log_format,默认为 \u0026#x27;%(asctime)s %(process)d %(filename)s L%(lineno)s %(levelname)s %(message)s\u0026#x27;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# client.set_stream_logger(stream=sys.stdout, level=logging.DEBUG)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# client.set_file_logger(file_path=\u0026quot;/log\u0026quot;, level=logging.DEBUG) 日志文件滚动输出,最多10个文件,单个文件最大512MB\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# client.set_default_logger() 去除所有log handler,默认不输出\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 实例化一个cvm实例信息查询请求对象,每个接口都会对应一个request对象。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e req \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e models\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDescribeInstancesRequest\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 填充请求参数,这里request对象的成员变量即对应接口的入参。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 您可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e respFilter \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e models\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eFilter\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 创建Filter对象, 以zone的维度来查询cvm实例。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e respFilter\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eName \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;zone\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e respFilter\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eValues \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e[\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ap-shanghai-1\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ap-shanghai-2\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e]\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e req\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eFilters \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e[\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003erespFilter\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e]\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# Filters 是成员为Filter对象的列表\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# python sdk支持自定义header如 X-TC-TraceId、X-TC-Canary,可以按照如下方式指定,header必须是字典类型的\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e headers \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e{\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;X-TC-TraceId\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ffe0c072-8a5d-4e17-8887-a8a60252abca\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e req\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eheaders \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e headers\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的,headers为可选参数。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e resp \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e client\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDescribeInstances\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ereq\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 输出json格式的字符串回包\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprint\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eresp\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eto_json_string\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eindent\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e2\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 也可以取出单个值。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 您可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprint\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eresp\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eTotalCount\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexcept\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e TencentCloudSDKException \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eas\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e err\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprint\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eerr\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"a087c265-1a9a-4c9c-bd77-3b73a3a253a2\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCommon Client 调用方式\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e从版本3.0.396开始,腾讯云 Python SDK 支持使用\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e泛用型的 API 调用方式(Common Client) \u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e进行请求。您只需安装 tencentcloud-sdk-python-common 包,即可向任何产品发起调用。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"tse-hint alert\\\" data-slate-node=\\\"element\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan style=\\\"color:#04C8DC\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e注意:\u003c/span\u003e\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e您必须明确了解您调用的接口所需的参数,否则可能会导致调用失败。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCommon Client 的示例请参见 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/common_client/describe_instances.py\\\" title=\\\"https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/common_client/describe_instances.py\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexample\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"022ce35b-0b79-44f1-adeb-480298b31479\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e更多示例\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e您可以在 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca class=\\\"ref\\\" href=\\\"https://github.com/tencentcloud/tencentcloud-sdk-python\\\" target=\\\"_blank\\\" data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\"\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eGitHub\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 的 examples 目录下找到更详细的示例代码。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"f3f3a693-fd27-410d-9a83-528339a9f4b6\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e相关配置\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"f66dbfbc-2f08-4853-af45-6057db873bf4\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e代理\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e如果您在使用有代理的环境下,可以通过以下两种方式设置代理:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e1.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e在初始化 HttpProfile 时指定 proxy。您可以参考 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/describe_zones.py\\\" title=\\\"https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/describe_zones.py\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eexample\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 来设置代理。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ol\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-markdown-ol-order\\\"\u003e2.\u003c!-- --\u003e \u003c/span\u003e\u003cspan class=\\\"tse-markdown-ol-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e设置系统环境变量 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ehttps_proxy\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e如果未正确设置代理,可能会导致无法正常进行调用,并抛出连接超时的异常。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch3 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"f027b118-559e-474b-bb48-f5490002c9a4\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e证书问题\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h3\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e在 Mac 操作系统安装 Python 3.6或更高版本时,可能会遇到证书错误。错误信息如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056).\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e这是因为在 Mac 操作系统下,Python 不再使用系统默认的证书,并且 Python 本身也不提供证书。在进行 HTTPS 请求时,需要使用 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecertifi\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 库提供的证书,但 SDK 不支持指定,因此只能通过执行以下命令来安装证书以解决此问题:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003esudo \u0026quot;/Applications/Python 3.6/Install Certificates.command\u0026quot;\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e对于 Python 2 版本,也可以使用类似的命令来解决类似的问题:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003esudo /Applications/Python 2.7/Install Certificates.command\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云 Python SDK 默认使用 certifi 库提供的证书。如果您需要指定其他证书,可以进行如下设置:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 指定证书\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ehttpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecertification \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;/path/to/certification\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e如果您想跳过证书校验,可以将参数设置为 False,进行如下设置:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 跳过证书校验\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ehttpProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecertification \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token boolean\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eFalse\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch2 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"6d1c6674-37d1-431c-908b-2e27bec41331\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e凭证管理\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云 Python SDK 目前支持以下几种方式进行凭证管理:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"ee67b052-8a89-437a-a4d7-aded2b102f7b\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e环境变量\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e默认情况下,SDK 会读取环境变量 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eTENCENTCLOUD_SECRET_ID\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 和 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eTENCENTCLOUD_SECRET_KEY\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 获取 SecretId 和 SecretKey。您可以使用以下代码获取凭证:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eEnvironmentVariableCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"2da4da5d-9fb5-48d3-ad2f-7de011216b35\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e配置文件\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e SDK 支持读取配置文件中的凭证信息。配置文件的路径要求如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eWindows:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap tse-level-1\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ec:\\\\\\\\Users\\\\\\\\NAME\\\\\\\\.tencentcloud\\\\\\\\credentials\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eLinux:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap tse-level-1\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-plaintext code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e~/.tencentcloud/credentials\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e 或 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003ccode\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e/etc/tencentcloud/credentials\u003c/span\u003e\u003c/code\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e配置文件的格式为 .ini 格式,示例如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-ini code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e[default]\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003esecret_id = xxxxx\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003esecret_key = xxxxx\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e您可以使用以下代码获取凭证:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eProfileCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"53a627f2-ecf6-4f66-8828-5e763f6edb65\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e角色扮演\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e有关角色扮演的相关概念请参见 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://cloud.tencent.com/document/product/598/19420\\\" title=\\\"https://cloud.tencent.com/document/product/598/19420\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云角色概述\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e。如果使用此种方式,您需要在腾讯云访问管理控制台上创建一个角色,具体创建过程请参见 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://cloud.tencent.com/document/product/598/19381\\\" title=\\\"https://cloud.tencent.com/document/product/598/19381\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云角色创建\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e在您拥有角色后,您可以使用以下代码获取临时凭证:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eSTSAssumeRoleCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;SecretId\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;SecretKey\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;RoleArn\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;RoleSessionName\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"20c6c21d-afe9-4f52-bb54-bd57efa8f2d8\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e实例角色\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e有关实例角色的相关概念请参见 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\" class=\\\"\\\" href=\\\"https://cloud.tencent.com/document/product/213/47668\\\" title=\\\"https://cloud.tencent.com/document/product/213/47668\\\" target=\\\"_blank\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云实例角色\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e在您为实例绑定角色后,您可以在实例中访问相关元数据接口获取临时凭证,SDK 会自动刷新临时凭证。相关代码如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCVMRoleCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"7175f509-7226-4645-a3a5-1db69d05ed44\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e凭证提供链\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e腾讯云 Python SDK 提供了凭证提供链,它会按照\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e环境变量 \u0026gt; 配置文件 \u0026gt; 实例角色 \u0026gt; TKE OIDC 凭证\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e的顺序尝试获取凭证,并返回第一个获取到的凭证。相关代码如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用默认凭证提供链\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDefaultCredentialProvider\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用环境变量\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eEnvironmentVariableCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用配置文件\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eProfileCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用实例角色\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eCVMRoleCredential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用TKE OIDC凭证\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecred \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eDefaultTkeOIDCRoleArnProvider\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eget_credential\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e具体示例代码可以参考 \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003ca class=\\\"ref\\\" href=\\\"https://github.com/TencentCloud/tencentcloud-sdk-python/blob/master/examples/cvm/v20170312/credential_providers.py\\\" target=\\\"_blank\\\" data-slate-node=\\\"element\\\" data-slate-inline=\\\"true\\\"\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecredential_providers.py \u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan contenteditable=\\\"false\\\"\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e中的示例。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"anchor-element\\\"\u003e\u003ch4 data-slate-node=\\\"element\\\" class=\\\"\\\" id=\\\"663b0cd3-63de-4392-a4b5-aff29284e681\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e地域容灾\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/h4\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e从版本v3.0.923开始,腾讯云 Python SDK 支持地域容灾功能。当某个域名请求失败时,SDK 会自动切换到容灾域名。使用方式如下:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e使用地域容灾功能时,有三种状态相互转换:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e关闭、全开\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e和\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e半开\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e状态。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e关闭状态\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:使用主要域名进行请求,如果出现错误,则会切换到全开状态。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e全开状态\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:使用容灾域名进行请求。当达到一定时间时,会切换到半开状态。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"tse-markdown-ul\\\"\u003e\u003cspan contenteditable=\\\"false\\\" class=\\\"tse-ul-symbol\\\"\u003e\u003c/span\u003e\u003cspan class=\\\"tse-ul-content\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cb\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e半开状态\u003c/span\u003e\u003c/b\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e:此时会将少量请求发送到主要域名,如果请求失败,则切换到全开状态。当请求成功数达到一定数量时,会切换到关闭状态。\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e以下是相关设置示例:\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 简单开启方式,此时所有的配置都是默认值\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprofile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclient_profile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclientProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003edisable_region_breaker \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token boolean\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eFalse\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# False表示使用地域容灾\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv data-slate-node=\\\"element\\\" class=\\\"code-block-wrap\\\"\u003e\u003cdiv contenteditable=\\\"false\\\" class=\\\"code-block-toolbar\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__item\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__btn\\\"\u003e\u003cdiv class=\\\"code-block-toolbar__icon\\\"\u003e\u003csvg viewBox=\\\"0 0 16 16\\\" fill=\\\"currentColor\\\"\u003e\u003cpath d=\\\"M11 14.75C11.4142 14.75 11.75 14.4142 11.75 14V11.75H14C14.4142 11.75 14.75 11.4142 14.75 11V2C14.75 1.58579 14.4142 1.25 14 1.25H5C4.58579 1.25 4.25 1.58579 4.25 2V4.25H2C1.58579 4.25 1.25 4.58579 1.25 5V14C1.25 14.4142 1.58579 14.75 2 14.75H11ZM5.75 4.25V2.75H13.25V10.25H11.75V5C11.75 4.58579 11.4142 4.25 11 4.25H5.75ZM5 5.75H2.75V13.25H10.25V5.75H5Z\\\" fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cpre class=\\\"language-python code-block\\\"\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 自定义配置\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003efrom\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e tencentcloud\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003ecommon\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eprofile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclient_profile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token keyword\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eimport\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e RegionBreakerProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eregionBreakerProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e RegionBreakerProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e backup_endpoint\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token string\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e\u0026quot;ap-beijing.tencentcloudapi.com\u0026quot;\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 备用地域,格式${region}.tencentcloudapi.com,必须是存在的域名,默认值为ap-guangzhou.tencentcloudapi.com\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e max_fail_num\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e3\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 最大失败数,默认值5\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e max_fail_percent\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e0.5\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 最大失败率,默认值0.75。当失败数达到最大失败数,且失败率达到最大的失败率时,或者连续失败数达到5次,关闭状态切换到开启状态\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e window_interval\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e60\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 计数窗口,单位s,默认300。处于关闭状态时,时间超过窗口则重新计数\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e timeout\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e30\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e,\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 全开时间,单位s,默认60。处于全开状态达到超过该时间,切换为半开状态\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e max_requests\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token number\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e3\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 最大成功请求数,默认5。处于半开状态时,请求主域名达到该数量则切换为关闭状态\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclientProfile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e ClientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e(\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e)\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003edisable_region_breaker \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token boolean\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eFalse\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token comment\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e# 使用地域容灾必须要将这个值置为false\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eclientProfile\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token punctuation\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003eregion_breaker_profile \u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\" class=\\\"prism-token token operator\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e=\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-string=\\\"true\\\"\u003e regionBreakerProfile\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/pre\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\\\"\\\" data-slate-node=\\\"element\\\"\u003e\u003cspan data-slate-node=\\\"text\\\"\u003e\u003cspan data-slate-leaf=\\\"true\\\"\u003e\u003cspan data-slate-zero-width=\\\"n\\\" data-slate-length=\\\"0\\\"\u003e\u003cbr/\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\",\"showToc\":true,\"toc\":\"\u003cli\u003e\u003ca href=\\\"#88cf3ad2-31f8-4fe9-a115-02604f377e7a\\\" title=\\\"简介\\\"\u003e简介\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#2268f3b7-f63b-4990-ae36-18686c6de852\\\" title=\\\"依赖环境\\\"\u003e依赖环境\u003c/a\u003e\u003cul class=\\\"tea-slate-sdk-toc-list no-border\\\"\u003e\u003cli\u003e\u003ca href=\\\"#56f4aa4e-c789-49b3-b904-2afdd479e717\\\" title=\\\"依赖问题\\\"\u003e依赖问题\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#024781ac-2df6-414a-90e7-603c7b836ef9\\\" title=\\\"获取安装\\\"\u003e获取安装\u003c/a\u003e\u003cul class=\\\"tea-slate-sdk-toc-list no-border\\\"\u003e\u003cli\u003e\u003ca href=\\\"#7cffce86-29eb-4ff5-8831-6c694063f1fe\\\" title=\\\"通过 Pip 安装(推荐)\\\"\u003e通过 Pip 安装(推荐)\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#2530a5a0-e470-41de-9697-41cf697aec4d\\\" title=\\\"通过源码包安装\\\"\u003e通过源码包安装\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#520e488f-a082-4a4e-89c3-e57708be1935\\\" title=\\\"示例\\\"\u003e示例\u003c/a\u003e\u003cul class=\\\"tea-slate-sdk-toc-list no-border\\\"\u003e\u003cli\u003e\u003ca href=\\\"#344fc147-8775-4af3-ba4b-d30d5c26b6ac\\\" title=\\\"简化版\\\"\u003e简化版\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#3cd4d4b2-ef47-4d62-8afc-17e73c8479fe\\\" title=\\\"详细版\\\"\u003e详细版\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#a087c265-1a9a-4c9c-bd77-3b73a3a253a2\\\" title=\\\"Common Client 调用方式\\\"\u003eCommon Client 调用方式\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#022ce35b-0b79-44f1-adeb-480298b31479\\\" title=\\\"更多示例\\\"\u003e更多示例\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#f3f3a693-fd27-410d-9a83-528339a9f4b6\\\" title=\\\"相关配置\\\"\u003e相关配置\u003c/a\u003e\u003cul class=\\\"tea-slate-sdk-toc-list no-border\\\"\u003e\u003cli\u003e\u003ca href=\\\"#f66dbfbc-2f08-4853-af45-6057db873bf4\\\" title=\\\"代理\\\"\u003e代理\u003c/a\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#f027b118-559e-474b-bb48-f5490002c9a4\\\" title=\\\"证书问题\\\"\u003e证书问题\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/li\u003e\u003cli\u003e\u003ca href=\\\"#6d1c6674-37d1-431c-908b-2e27bec41331\\\" title=\\\"凭证管理\\\"\u003e凭证管理\u003c/a\u003e\u003c/li\u003e\",\"recentReleaseTime\":\"2023-10-19 10:34:31\",\"videoConfig\":{\"position\":\"top\",\"list\":[]},\"githubUrl\":\"https://github.com/tencentyun/qcloud-documents/blob/master/开发者资源/云API%20SDK/通用语言%20SDK/Python SDK.md\",\"isSlate\":true,\"writeNodeId\":\"113486040070201344\",\"displayEditEntry\":true,\"slate\":\"\\\"[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"简介\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"AZ7HmZpxRhFxUDLsl0LOV\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"88cf3ad2-31f8-4fe9-a115-02604f377e7a\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"欢迎使用腾讯云开发者工具套件(SDK)3.0,SDK 3.0是云 API 3.0平台的配套工具。目前已经支持云服务器 CVM、私有网络 VPC、云硬盘 CBS 等产品,将来会支持更多云服务产品。新版 SDK 实现了统一化,具有各个语言版本的 SDK 使用方法相同、接口调用方式相同,统一的错误码和返回包格式等优点。\\\\\\\\n为方便 Python 开发者调试和接入腾讯云产品 API,本文向您介绍适用于 Python 的腾讯云开发工具包,提供了简单示例来帮助您快速获取腾讯云 Python SDK 并开始调用。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aYSc1R96L8I90nhzv0M7M\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"依赖环境\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"my1wXwnBHh_XnZ87hnROr\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"2268f3b7-f63b-4990-ae36-18686c6de852\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"支持的版本:Python 2.7,3.6-3.9\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"iQnE27MrcJ9Pdb-8QItoT\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"从 \\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"ref\\\\\\\",\\\\\\\"props\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fconsole.cloud.tencent.com\\\\u002F\\\\\\\"},\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云控制台\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"XZ5emBUSHJGJaW3sjELId\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 开通相应产品。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"3N-JkWjzdSfDx7OOpNZ6x\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"4MjJauSL6PTCw-o7a7gtH\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"获取 SecretID、SecretKey 以及调用地址(endpoint)。云 API 密钥 SecretId 和 SecretKey 请前往 \\\\\\\"},{\\\\\\\"id\\\\\\\":\\\\\\\"wQhVpKmJw8cQYr4h6k8gO\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"API 密钥管理\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"ref\\\\\\\",\\\\\\\"props\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fconsole.cloud.tencent.com\\\\u002Fcam\\\\u002Fcapi\\\\\\\"},\\\\\\\"linkTitle\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fconsole.cloud.tencent.com\\\\u002Fcam\\\\u002Fcapi\\\\\\\",\\\\\\\"linkTarget\\\\\\\":\\\\\\\"blank\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 获取。endpoint 一般形式为 *.tencentcloudapi.com,例如云服务器 CVM 的调用地址为 cvm.tencentcloudapi.com,详情请参见各产品的说明文档。\\\\\\\"}]},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"依赖问题\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"DIRARXkqBA6kuNz9eCULI\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"56f4aa4e-c789-49b3-b904-2afdd479e717\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"本项目依赖 requests 库,由于 requests 库2.30.0及以上的版本适配了 urllib 3 2.0版本,如果您在使用 SDK 时遇到以下错误:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"t8AqakAlaWb1-bjRfrb6i\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"QUdUZ3f9cDVPfshb0z8QB\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.x'\\\\\\\"}]}],\\\\\\\"id\\\\\\\":\\\\\\\"PIzgFBKLlpw8abRkfyozd\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"您可以尝试以下解决方法:\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"dV13IQNWGPPBQP0_wt-ua\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"将 urllib3的版本降低到1.26.x版本(requests 库的依赖版本在1.21.1到3之间)。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"eHV_7U6An833rVDZksl-c\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"使用 OpenSSL 1.1.1+版本,重新编译 Python 环境。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Mgj6YKCGbVafaT3kna0aC\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"获取安装\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-xf9d_pCjezE1ZjvIoZhY\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"024781ac-2df6-414a-90e7-603c7b836ef9\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"在安装 Python SDK 之前,请先获取安全凭证。在首次使用云 API 之前,您需要在腾讯云控制台上申请安全凭证。安全凭证包括 SecretID 和 SecretKey。SecretID 用于标识 API 调用者的身份,SecretKey 用于加密签名字符串和服务器端验证签名字符串。请严格保管 SecretKey,避免泄露。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"eO2Y_2mmxIg7KKAQ9W62A\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"通过 Pip 安装(推荐)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"t97-Xmf9CCfdGN9I3Xg6L\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"7cffce86-29eb-4ff5-8831-6c694063f1fe\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"您可以使用 pip 安装方式将腾讯云 API Python SDK 安装到您的项目中。如果您的项目环境尚未安装 pip,请参见 \\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"ref\\\\\\\",\\\\\\\"props\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fpip.pypa.io\\\\u002Fen\\\\u002Fstable\\\\u002Finstallation\\\\u002F\\\\\\\"},\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"pip\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"GHf1zfRszTN3tnZrZ9WPr\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 官网安装。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"HBMZ5oLi4aXdXiBWj29tR\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"执行以下命令在命令行中使用 pip 安装或更新腾讯云 API Python SDK:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"fMkXPDN0O8aUOkaHZ03g2\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"pip install --upgrade tencentcloud-sdk-python\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"UIGGNFmba7RGjtabxCG71\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"bash\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"srZL_bfT3uAQ4HDFL1Lzn\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"中国大陆地区的用户可以使用国内镜像源以提高下载速度,例如:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"PZNeka1PWLq8mSPUJ25XN\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"code\\\\\\\":1,\\\\\\\"text\\\\\\\":\\\\\\\"pip install -i https:\\\\u002F\\\\u002Fmirrors.tencent.com\\\\u002Fpypi\\\\u002Fsimple\\\\u002F --upgrade tencentcloud-sdk-python\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"xFynkP1SdLwf10B82UitG\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"eTuDh-DZSa7E61ly360z7\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"hint\\\\\\\",\\\\\\\"hintType\\\\\\\":\\\\\\\"alert\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"b\\\\\\\":1,\\\\\\\"text\\\\\\\":\\\\\\\"注意:\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"#04C8DC\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"FHA6Y1FOLS6LpqTIJ-8XY\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"如果您的 Python 环境同时存在 Python2 和 Python3, Python3 环境需要使用 pip3 命令安装。\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"g1MoXiOrmpSjkZBW4ocrz\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"zFFU1EMCRQDbrY7zpaFA-\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"如果您只想使用某个具体产品的包,例如云服务器 CVM,可以单独安装该包。请注意,单独安装某个产品的包时,不能与总包同时工作。本文以安装云服务器 CVM 包为例,命令如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"jMOX9op5-_Y3ECiPJIxg0\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"pip install --upgrade tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm\\\\\\\",\\\\\\\"code\\\\\\\":1}],\\\\\\\"id\\\\\\\":\\\\\\\"lEKz0IwQynJFJX-zJDPV8\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"19CNwAyG5dSKFZpS9K6yq\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"通过源码包安装\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"xwroSPvdkn6Bjze3pnF66\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"2530a5a0-e470-41de-9697-41cf697aec4d\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"前往 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Github 仓库\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002Ftencentcloud\\\\u002Ftencentcloud-sdk-python\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002Ftencentcloud\\\\u002Ftencentcloud-sdk-python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"pQz8ukzmlKVYekLHzjvBa\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 或者 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Gitee 仓库\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgitee.com\\\\u002Ftencentcloud\\\\u002Ftencentcloud-sdk-python\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgitee.com\\\\u002Ftencentcloud\\\\u002Ftencentcloud-sdk-python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"QvMTnJ8wDc5BjijJxq1_m\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 下载最新代码。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"cDktVBJ0Dw_vygUnHX69u\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"0pDjxmBIdxBbBlUuVPMyz\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"解压下载的源码包。\\\\\\\"}]},{\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"TccTCQKyg0vi5iLdJb7Rf\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"打开命令行终端,进入解压后的 tencentcloud-sdk-python 目录,执行以下命令来安装 SDK:\\\\\\\"}]},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"$ cd tencentcloud-sdk-python\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"96EzHBMmoi21g4iPQFX1m\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"$ python setup.py install\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-5BGLWU8JZLiu3ULbbPy0\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"bash\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"k9jIqgtE0u3y-NFL8Jirb\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false,\\\\\\\"indent\\\\\\\":1},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"示例\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"MC9WRLGFAGtx5lfdm1DVw\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"520e488f-a082-4a4e-89c3-e57708be1935\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"本文以云服务器 CVM 产品的 DescribeInstances 接口为例:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"IjDWwpOhHecjgbqbUQBNN\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"简化版\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"gcQtAa4A836xOIvtuB3Sm\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"344fc147-8775-4af3-ba4b-d30d5c26b6ac\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"import os\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Okgc0bn4vPBHQowdl6GUX\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"xFKgubQUDygyX5ovp0JPx\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"w4XQEEAdUH_nJNKBzuKsp\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.cvm.v20170312 import cvm_client, models\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"XqltQV4oHR10_7BAFD3qs\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ujnwhUBVLVaihMyt7nQmx\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"try:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"clZtrI7lv9t79UICiWlQy\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"YTSSWdUvRLnC1Ex6Qbn9V\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"kEiImGmzQTVu3IpSmrQGu\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # cred = credential.Credential(\\\\\\\\\\\\\\\"secretId\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"secretKey\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"2M81vFAIO5eTOF19Zx5WM\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" cred = credential.Credential(\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7ksExMXNLV9pwXnobeBu4\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" os.environ.get(\\\\\\\\\\\\\\\"TENCENTCLOUD_SECRET_ID\\\\\\\\\\\\\\\"),\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"QJhvUpLXy11KNjqapheVU\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" os.environ.get(\\\\\\\\\\\\\\\"TENCENTCLOUD_SECRET_KEY\\\\\\\\\\\\\\\"))\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"57_4BSbMEEzJt5jy6dYJ9\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" client = cvm_client.CvmClient(cred, \\\\\\\\\\\\\\\"ap-shanghai\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"09TBfIxX6rsrC5VmXHBzH\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"27NYchDgQSe_CJQcSo4co\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" req = models.DescribeInstancesRequest()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"X73VDBsDC8SMHTzOADjqn\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" resp = client.DescribeInstances(req)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"pkt7yNeClv7gPqaZQShNl\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ukn5bdRrDg55TUrkJv4k8\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" print(resp.to_json_string())\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"VkdjxQVlC9SukMrmd2zRw\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"except TencentCloudSDKException as err:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ZIFwcRHnmkTW_HxIQ8jiq\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" print(err)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"4VqUQsRtsIShbjzMomkKV\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"j0qpMpMh_nKCJp7cK7tYX\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"详细版\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"CjhQN72zGyoHKEB-wWax5\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"3cd4d4b2-ef47-4d62-8afc-17e73c8479fe\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# -*- coding: utf-8 -*-\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"k9Uz6IGykBzISwZ7lH2Vy\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"import os\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"pyNUJcb2aKQ-yP7UsWKpU\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"import sys\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"UDMd5q74WB-trp7M7kx5j\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"import logging\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"cMG1VI0ndnFlb3CeK77_O\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1PRw2jndjhdg7jf3oLnBD\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"M2kqLabkrUqgx1GX6c0QA\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aOaKfY8qM6sR46c0E6YFu\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 导入对应产品模块的client models。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"0MWa5Ibo-VXSlih4LiScI\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.cvm.v20170312 import cvm_client, models\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Hk0cmfOQ2ricoshf-N6IZ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"a8hZbOiaOnEyZazuEeYOl\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 导入可选配置类\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ky9vw7UZJIhICA36Nx5Ez\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.profile.client_profile import ClientProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"4-dJyzvtrbYYjAh11UZoq\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.profile.http_profile import HttpProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"xcbueiJg4nhHTaJjPxtId\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"try:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"uRelS4buxL1gOjaeYWW16\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Cd9qNkPpInDZdOawTak9a\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1cigIvPAeokQKLuA-UGEs\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"jSu-EpuSzDaqAU2CFhAg5\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # cred = credential.Credential(\\\\\\\\\\\\\\\"secretId\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"secretKey\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6ad9wuP4WbLp9dvLuwDkC\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" cred = credential.Credential(\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ANJ1zxcaEyNfEt_CiFiI7\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" os.environ.get(\\\\\\\\\\\\\\\"TENCENTCLOUD_SECRET_ID\\\\\\\\\\\\\\\"),\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Pc_f5zivLf-FhNsdhrICp\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" os.environ.get(\\\\\\\\\\\\\\\"TENCENTCLOUD_SECRET_KEY\\\\\\\\\\\\\\\"))\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"33cC0uplYEEUHSp_VIBD0\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" cred = credential.Credential(\\\\\\\\\\\\\\\"SecretId\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"SecretKey\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Q4QNevNFXDFsm6h0Snm4e\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Zz56jMvd83aZDYBRKO4nS\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 实例化一个http选项,可选的,没有特殊需求可以跳过。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6_CeQ7r8LadYoltdtx2kc\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile = HttpProfile()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6Te5EvVlkPVqe5uCgLFnK\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 如果需要指定proxy访问接口,可以按照如下方式初始化hp\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-caoVj605UvjXhZQbLx44\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # httpProfile = HttpProfile(proxy=\\\\\\\\\\\\\\\"http:\\\\u002F\\\\u002F用户名:密码@代理IP:代理端口\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7nm9k41bLOt9cHS9Ya4YR\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile.protocol = \\\\\\\\\\\\\\\"https\\\\\\\\\\\\\\\" # 在外网互通的网络环境下支持http协议(默认是https协议),建议使用https协议\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"SrTcFSqVBuvXkJVHFK1-z\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile.keepAlive = True # 状态保持,默认是False\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"HApWSNLihvGfBIDemPUX3\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile.reqMethod = \\\\\\\\\\\\\\\"GET\\\\\\\\\\\\\\\" # get请求(默认为post请求)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"HYAuKOAo8IhNdfH0SIuAT\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"3fR2sIamTA8l-wErYrJos\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" httpProfile.endpoint = \\\\\\\\\\\\\\\"cvm.ap-shanghai.tencentcloudapi.com\\\\\\\\\\\\\\\" # 指定接入地域域名(默认就近接入)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"YrtBHuxvgRiEaBnjRpqut\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"JeLI2B6hRynPUmk4BEHQZ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 实例化一个client选项,可选的,没有特殊需求可以跳过。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Kk_efbh7vDl3tP4fFWsH2\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" clientProfile = ClientProfile()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7-21m-sXbmQs5ac8GOPJp\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" clientProfile.signMethod = \\\\\\\\\\\\\\\"TC3-HMAC-SHA256\\\\\\\\\\\\\\\" # 指定签名算法\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1cRpXKfH_5IXJ3UZ8jKni\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" clientProfile.language = \\\\\\\\\\\\\\\"en-US\\\\\\\\\\\\\\\" # 指定展示英文(默认为中文)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"JKn2meeXxNl_uejppfcV3\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" clientProfile.httpProfile = httpProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"q9l0Ib-TkFOrd9p1p5F2D\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"SU0PpgJFoMBL0jSdclKFM\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 实例化要请求产品(以cvm为例)的client对象,clientProfile是可选的。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"3_BiL3Qe7_AgFncVUR3Ah\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" client = cvm_client.CvmClient(cred, \\\\\\\\\\\\\\\"ap-shanghai\\\\\\\\\\\\\\\", clientProfile)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ComLP6xjly1406OtHkYMj\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"tXhKrrwrSE09sbmyTS9u3\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 打印日志按照如下方式,也可以设置log_format,默认为 '%(asctime)s %(process)d %(filename)s L%(lineno)s %(levelname)s %(message)s'\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"UDStCLiFjQuub-APtOn1_\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # client.set_stream_logger(stream=sys.stdout, level=logging.DEBUG)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"WF_ndPmXQWo3VWEXkk0V5\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # client.set_file_logger(file_path=\\\\\\\\\\\\\\\"\\\\u002Flog\\\\\\\\\\\\\\\", level=logging.DEBUG) 日志文件滚动输出,最多10个文件,单个文件最大512MB\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"RflRHXlBFXgBvMyW3pvVw\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # client.set_default_logger() 去除所有log handler,默认不输出\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"a7y8mxPx-x01EkprzxOo3\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6L_B3lWfy7e_qQRHNwxhs\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 实例化一个cvm实例信息查询请求对象,每个接口都会对应一个request对象。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"RVENUliJ9svcHdgnj0t8C\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" req = models.DescribeInstancesRequest()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"wWj4A-hwaVeTi6LgyMSN5\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6ckhHJGrV5tZpxG-FQ1eD\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 填充请求参数,这里request对象的成员变量即对应接口的入参。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"QkrVrIlYlZ5CiClhMN4u9\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 您可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"qReaWj3Cw8eAgMCIummMF\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" respFilter = models.Filter() # 创建Filter对象, 以zone的维度来查询cvm实例。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"iQezJz10erxQ3nHs9YeMc\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" respFilter.Name = \\\\\\\\\\\\\\\"zone\\\\\\\\\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"q397ch5x4V32o0Yb5yyXp\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" respFilter.Values = [\\\\\\\\\\\\\\\"ap-shanghai-1\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"ap-shanghai-2\\\\\\\\\\\\\\\"]\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"wBsGhbk-9eXWunzmiqW7L\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" req.Filters = [respFilter] # Filters 是成员为Filter对象的列表\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6OKsLY3ezdHNn0dhXocVz\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Vt7PjeRg9sgKrBks51chO\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # python sdk支持自定义header如 X-TC-TraceId、X-TC-Canary,可以按照如下方式指定,header必须是字典类型的\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"D1tw50TgGrNb2IUqwImza\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" headers = {\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"YaMMA9KXBqbnUeNJNWtLi\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" \\\\\\\\\\\\\\\"X-TC-TraceId\\\\\\\\\\\\\\\": \\\\\\\\\\\\\\\"ffe0c072-8a5d-4e17-8887-a8a60252abca\\\\\\\\\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"yj5lM8wkb217MuERCsZfr\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" }\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7pOrLvShlwb20C7jHmGHJ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" req.headers = headers\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"86ps_IhA2LcxkXs-gOt42\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Q5QmvL49J5yiT5OgRG-jv\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的,headers为可选参数。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"INLVRCKF4mEsHO84g21uJ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"TuKxYbn1iNFfuWUPSuIbr\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" resp = client.DescribeInstances(req)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"eFdDPpWJ3q5VlLjGpoBti\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"_O6IKj3Ih2uLldYMw0f82\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 输出json格式的字符串回包\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6WglEE6TP7qxyA3lfVPm9\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" print(resp.to_json_string(indent=2))\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"W_EYTyaosQOb6VfW_0lL2\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"PE1QUSb9DDO-jUuksCiQ5\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 也可以取出单个值。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Wbfq7NiBDqgzGjIbG3e43\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" # 您可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"KS8hx6K6LVKERTB8-xQNh\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" print(resp.TotalCount)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"yyXY7CmUedgw2nQa_4qss\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"except TencentCloudSDKException as err:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"MWhMiTiQcPheJHd8Pei9O\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" print(err)\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"8eiYNLTmoS0LVf_dv4rpO\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7PbH13tcShFIpYP7ggIVq\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Common Client 调用方式\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"GevIHoluAS07-6mi111ca\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"a087c265-1a9a-4c9c-bd77-3b73a3a253a2\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"从版本3.0.396开始,腾讯云 Python SDK 支持使用\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"泛用型的 API 调用方式(Common Client) \\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\"进行请求。您只需安装 tencentcloud-sdk-python-common 包,即可向任何产品发起调用。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-EJ8SzizmEyfY61_L8NHm\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"hint\\\\\\\",\\\\\\\"hintType\\\\\\\":\\\\\\\"alert\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"b\\\\\\\":1,\\\\\\\"text\\\\\\\":\\\\\\\"注意:\\\\\\\",\\\\\\\"color\\\\\\\":\\\\\\\"#04C8DC\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"74Bk3H72YlAftl5djUpLv\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"您必须明确了解您调用的接口所需的参数,否则可能会导致调用失败。\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"rZyBTAmyt4xrYDUprTxmz\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"UMBN2A8eWanAmmLcA9B6d\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Common Client 的示例请参见 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"example\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002FTencentCloud\\\\u002Ftencentcloud-sdk-python\\\\u002Fblob\\\\u002Fmaster\\\\u002Fexamples\\\\u002Fcommon_client\\\\u002Fdescribe_instances.py\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002FTencentCloud\\\\u002Ftencentcloud-sdk-python\\\\u002Fblob\\\\u002Fmaster\\\\u002Fexamples\\\\u002Fcommon_client\\\\u002Fdescribe_instances.py\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1n1fwOkGRyUhBtZOWNAFV\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"4mvycecitgaLCqbdqazT_\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"更多示例\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Rybe25Lm8hOYm3CsjrUrt\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"022ce35b-0b79-44f1-adeb-480298b31479\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"您可以在 \\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"ref\\\\\\\",\\\\\\\"props\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002Ftencentcloud\\\\u002Ftencentcloud-sdk-python\\\\\\\"},\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"GitHub\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"i9czBwSc1EFrZ8TGRtXcq\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 的 examples 目录下找到更详细的示例代码。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ccQ6KHweaIauGDwwOCi4K\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"相关配置\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Vx2zm32lMQ9cjZHpagZ0g\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"f3f3a693-fd27-410d-9a83-528339a9f4b6\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"代理\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Y6FF_jfS6_S_1VK-IAnEj\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"f66dbfbc-2f08-4853-af45-6057db873bf4\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"如果您在使用有代理的环境下,可以通过以下两种方式设置代理:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"N_twO_lABCds4YWi2xGzf\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"在初始化 HttpProfile 时指定 proxy。您可以参考 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"example\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002FTencentCloud\\\\u002Ftencentcloud-sdk-python\\\\u002Fblob\\\\u002Fmaster\\\\u002Fexamples\\\\u002Fcvm\\\\u002Fv20170312\\\\u002Fdescribe_zones.py\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002FTencentCloud\\\\u002Ftencentcloud-sdk-python\\\\u002Fblob\\\\u002Fmaster\\\\u002Fexamples\\\\u002Fcvm\\\\u002Fv20170312\\\\u002Fdescribe_zones.py\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Vm_9tcZfBLx9iGDLcV47b\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\" 来设置代理。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"9GS-Hx5Ke4r9-fDFGUK6c\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"oli\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"设置系统环境变量 \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"https_proxy\\\\\\\",\\\\\\\"code\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\"。\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"D2ry5tncgYVgXXr0azv8Q\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"如果未正确设置代理,可能会导致无法正常进行调用,并抛出连接超时的异常。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"XvV7suWkkKyyJUWiJLjuT\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"证书问题\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h3\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"dDTHuQGwYl98mwBKm8MG6\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"f027b118-559e-474b-bb48-f5490002c9a4\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"在 Mac 操作系统安装 Python 3.6或更高版本时,可能会遇到证书错误。错误信息如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"QtcCMGiXpczG6hAmTqP8W\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ZNdbRUV6TtXZOwAuGdmKO\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056).\\\\\\\"}]}],\\\\\\\"id\\\\\\\":\\\\\\\"NcyCGD8-wr-fvME91JR-a\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Alao26qP0jZOrFDN7B9m9\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"这是因为在 Mac 操作系统下,Python 不再使用系统默认的证书,并且 Python 本身也不提供证书。在进行 HTTPS 请求时,需要使用 \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"certifi\\\\\\\",\\\\\\\"code\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\" 库提供的证书,但 SDK 不支持指定,因此只能通过执行以下命令来安装证书以解决此问题:\\\\\\\"}]},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"sudo \\\\\\\\\\\\\\\"\\\\u002FApplications\\\\u002FPython 3.6\\\\u002FInstall Certificates.command\\\\\\\\\\\\\\\"\\\\\\\",\\\\\\\"code\\\\\\\":1}],\\\\\\\"id\\\\\\\":\\\\\\\"lINMHOd8hDlsfTr84WmyG\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"EfWCbkEPx1ppxuFhyaUpW\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"对于 Python 2 版本,也可以使用类似的命令来解决类似的问题:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"quHHmJSuSp9mcaCWJJ_Z1\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"jooOhKnaNGdjlWXG54oZb\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"sudo \\\\u002FApplications\\\\u002FPython 2.7\\\\u002FInstall Certificates.command\\\\\\\"}]}],\\\\\\\"id\\\\\\\":\\\\\\\"kZNjUWnfmxO4slZuJ9-tN\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云 Python SDK 默认使用 certifi 库提供的证书。如果您需要指定其他证书,可以进行如下设置:\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"t18LhVFTrbvRydBJUXsBR\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 指定证书\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"RJNjasSgDm7X_J-FnNa7V\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"httpProfile.certification = \\\\\\\\\\\\\\\"\\\\u002Fpath\\\\u002Fto\\\\u002Fcertification\\\\\\\\\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"HDU9sI9fTwuZQQ8FR2TgF\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"1btlqp3GBHby66vqcVIeq\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ub0VvCNR9XnxXuPwJnMGM\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"如果您想跳过证书校验,可以将参数设置为 False,进行如下设置:\\\\\\\"}]},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 跳过证书校验\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"iyjMsxSSiNN9QpECpXZ-g\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"httpProfile.certification = False\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"wUy0r0VnC0PiuAPERk7kX\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"SXudjcvU1K-Gese9SkBNq\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"凭证管理\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h2\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"KuGzO_oLnHnxZXNsGXYxG\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"6d1c6674-37d1-431c-908b-2e27bec41331\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云 Python SDK 目前支持以下几种方式进行凭证管理:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"dBuSIwK-eNVHv7x8zkCnV\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"环境变量\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"AB_Vd100M1xtvF8dbR3MU\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"ee67b052-8a89-437a-a4d7-aded2b102f7b\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"默认情况下,SDK 会读取环境变量 \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"TENCENTCLOUD_SECRET_ID\\\\\\\",\\\\\\\"code\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\" 和 \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"TENCENTCLOUD_SECRET_KEY\\\\\\\",\\\\\\\"code\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\" 获取 SecretId 和 SecretKey。您可以使用以下代码获取凭证:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"j4AZ1fK4HpV-wQHWDPKyj\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"0qmuw-8ynwt4LZoeufQyM\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.EnvironmentVariableCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"VLzu7XV4k8N3v7_Ht8Ygc\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"XIEPgHuj9c4p72bQe5vRt\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"配置文件\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aQMF8KSwjNR-Jia6OmdKD\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"2da4da5d-9fb5-48d3-ad2f-7de011216b35\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" SDK 支持读取配置文件中的凭证信息。配置文件的路径要求如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"FpsJ1aNQ4mIOIth5LZKg1\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Windows:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"tUUwxKKjiws63qKd_zquk\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"3t-tqHUSQls_cxbTgpEDa\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"c:\\\\\\\\\\\\\\\\Users\\\\\\\\\\\\\\\\NAME\\\\\\\\\\\\\\\\.tencentcloud\\\\\\\\\\\\\\\\credentials\\\\\\\",\\\\\\\"code\\\\\\\":1}]}],\\\\\\\"id\\\\\\\":\\\\\\\"Ns7sVu0ldFL6wiCL0uG8E\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false,\\\\\\\"indent\\\\\\\":1},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"Linux:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"zvojU_WtYP-8sNjBgcWA1\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"plaintext\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"~\\\\u002F.tencentcloud\\\\u002Fcredentials\\\\\\\",\\\\\\\"code\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\" 或 \\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\u002Fetc\\\\u002Ftencentcloud\\\\u002Fcredentials\\\\\\\",\\\\\\\"code\\\\\\\":1}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"KlVdOdBsxim0Rs9VYg9ai\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"ayoj73_nfS9l4H1pGM1ca\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false,\\\\\\\"indent\\\\\\\":1},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"配置文件的格式为 .ini 格式,示例如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Myga4t58KVYB1SPOb4T35\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"[default]\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"t1_gbV8cEYuFG0l8M8Sxq\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"secret_id = xxxxx\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"58m_ONCqy3Z4Ir7SdpEFx\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"secret_key = xxxxx\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6jzKp8vKUeu5Tow2PyR46\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"ini\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ApCSlOE64GtBFahTw_f5w\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"您可以使用以下代码获取凭证:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"smpmHD7dYMCJpOWb9o91P\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"wSFQHAeBXjMsmwELEFSWm\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.ProfileCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"el1gffrGK8ph4u2NRbiN8\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"IXpzEvSlaniPn7QlV1o8J\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"角色扮演\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"K-XLpWxPl_UWPml-Bklje\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"53a627f2-ecf6-4f66-8828-5e763f6edb65\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"有关角色扮演的相关概念请参见 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云角色概述\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F598\\\\u002F19420\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F598\\\\u002F19420\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1C9Wwc1zcy6OlLtR-9xly\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"。如果使用此种方式,您需要在腾讯云访问管理控制台上创建一个角色,具体创建过程请参见 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云角色创建\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F598\\\\u002F19381\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F598\\\\u002F19381\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"1Lr4q060NG4-aCutdMT7i\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"_s-047K-gnyZ7HLGt1ReW\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"在您拥有角色后,您可以使用以下代码获取临时凭证:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"DGFTfuHYtGwXsnwWo5lOO\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aOYloLXCCIvN69k2Z5Jbm\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.STSAssumeRoleCredential(\\\\\\\\\\\\\\\"SecretId\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"SecretKey\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"RoleArn\\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\"RoleSessionName\\\\\\\\\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"zwQACBEOaH7WEa6s5Wnq6\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ZYPmx4DLQgvgQiynyQIKT\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"实例角色\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"NNWxU4HoLHXW8obVX6xSI\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"20c6c21d-afe9-4f52-bb54-bd57efa8f2d8\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"有关实例角色的相关概念请参见 \\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云实例角色\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"title\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F213\\\\u002F47668\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fcloud.tencent.com\\\\u002Fdocument\\\\u002Fproduct\\\\u002F213\\\\u002F47668\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"W-XZ0alQSBt4cXOuCBSIN\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"c7BRnMbhGNX1XdOALs_fD\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"在您为实例绑定角色后,您可以在实例中访问相关元数据接口获取临时凭证,SDK 会自动刷新临时凭证。相关代码如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"svAXzb9oKuwgVZ96wvQK1\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aPAppJbX_qkI7J1khKSde\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.CVMRoleCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"UFOh89zO0iqlAPFWwzv4A\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"8xItegKRaCicf_r1zQCS8\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"凭证提供链\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"AQiHUMqH410WWDSqGhe3i\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"7175f509-7226-4645-a3a5-1db69d05ed44\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"腾讯云 Python SDK 提供了凭证提供链,它会按照\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"环境变量 \\\\u003E 配置文件 \\\\u003E 实例角色 \\\\u003E TKE OIDC 凭证\\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\"的顺序尝试获取凭证,并返回第一个获取到的凭证。相关代码如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"lX3iAbFidiq_sNPc0eI9_\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 使用默认凭证提供链\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"7xiH2hkLcAjct2i2JrJau\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Z-7-aqpr9WDe2ALsUQ8mL\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.DefaultCredentialProvider().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ZehJp1ZaV2E_frvHarRYB\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"PEPheUVewYw5fFYMiXI6A\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 使用环境变量\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Nu0hC35ZOErMdCTuZn8C1\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Ha8s7wqpnEuWwRpH2P9eN\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.EnvironmentVariableCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"yqgg3Wx6tgRoDVszx6lMY\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"RP18J0WsKsWDL71hxNtuP\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 使用配置文件\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"RArK6wUGlcqubG7YmylUQ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"BFU0mNksKildj--RT02l9\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.ProfileCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"cm8h4MsW3Hhmql3LReqWJ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"FbqW0qlTKPlJDUZOe_ELx\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 使用实例角色\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Gt8_aGmYr3Ffmcxy5uJRR\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"eoYCuBK2-L92nJtXAtSzS\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.CVMRoleCredential().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"hsT2AC7O3og9Bp4ePIgnZ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-fOvmT7T9VPfp2ZBX5gNW\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 使用TKE OIDC凭证\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6175FBTrms1ZeJasMDlS8\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common import credential\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"cOPnzbOLwzz_CzIunAN-B\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"cred = credential.DefaultTkeOIDCRoleArnProvider().get_credential()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"aXpSIjIQdm7BgQYZCfknY\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"bdFb7ERcfPq9mO9qFrap2\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"具体示例代码可以参考 \\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"ref\\\\\\\",\\\\\\\"props\\\\\\\":{\\\\\\\"type\\\\\\\":\\\\\\\"link\\\\\\\",\\\\\\\"url\\\\\\\":\\\\\\\"https:\\\\u002F\\\\u002Fgithub.com\\\\u002FTencentCloud\\\\u002Ftencentcloud-sdk-python\\\\u002Fblob\\\\u002Fmaster\\\\u002Fexamples\\\\u002Fcvm\\\\u002Fv20170312\\\\u002Fcredential_providers.py\\\\\\\"},\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"credential_providers.py \\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"OJp0UOLX_6hJrj1QEIerD\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"中的示例。\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"xxahHs1GnJPGyKXK1sBRx\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"h4\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"MCg4VQHlmw5Ps0SmrABTf\\\\\\\",\\\\\\\"nodeId\\\\\\\":\\\\\\\"663b0cd3-63de-4392-a4b5-aff29284e681\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"地域容灾\\\\\\\"}]},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"从版本v3.0.923开始,腾讯云 Python SDK 支持地域容灾功能。当某个域名请求失败时,SDK 会自动切换到容灾域名。使用方式如下:\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"vsa85Fqc8KKXPZuiaf2hv\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"6BoNWGb_SuxnGkWmM42kM\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"使用地域容灾功能时,有三种状态相互转换:\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"关闭、全开\\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\"和\\\\\\\"},{\\\\\\\"b\\\\\\\":1,\\\\\\\"text\\\\\\\":\\\\\\\"半开\\\\\\\"},{\\\\\\\"text\\\\\\\":\\\\\\\"状态。\\\\\\\"}]},{\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"关闭状态\\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\":使用主要域名进行请求,如果出现错误,则会切换到全开状态。\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"kUGva1Xf0ts3d0TGd2XrV\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"全开状态\\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\":使用容灾域名进行请求。当达到一定时间时,会切换到半开状态。\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"bgkpc_1ok5tv0fOc5lfpe\\\\\\\"},{\\\\\\\"type\\\\\\\":\\\\\\\"uli\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"HEEyg_nma1BWYm2hwc6eP\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"半开状态\\\\\\\",\\\\\\\"b\\\\\\\":1},{\\\\\\\"text\\\\\\\":\\\\\\\":此时会将少量请求发送到主要域名,如果请求失败,则切换到全开状态。当请求成功数达到一定数量时,会切换到关闭状态。\\\\\\\"}]},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"-leZTzALhNt6RX-TsgxSM\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"以下是相关设置示例:\\\\\\\"}]},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 简单开启方式,此时所有的配置都是默认值\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"G1iySSZ0-zbp3UjHWziRK\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.profile.client_profile import ClientProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"3TbiP-ve1a_RTO0FZSq0Q\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"clientProfile = ClientProfile()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"dF1dDJI8GCkoHRqfQtDrA\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"clientProfile.disable_region_breaker = False # False表示使用地域容灾\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"CNZJAvsHFLLqKDAIBBZiQ\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"T-Dtjjiat6FSZ9pC0QiK6\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"children\\\\\\\":[{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"# 自定义配置\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"9_2ZRUwMO9kIYIggcuD5d\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"from tencentcloud.common.profile.client_profile import ClientProfile, RegionBreakerProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"vlYBAiJg2wwvmvlWM31SJ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"regionBreakerProfile = RegionBreakerProfile(\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"PVKaV0rc8_D7JWOJW2dYB\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" backup_endpoint=\\\\\\\\\\\\\\\"ap-beijing.tencentcloudapi.com\\\\\\\\\\\\\\\", # 备用地域,格式${region}.tencentcloudapi.com,必须是存在的域名,默认值为ap-guangzhou.tencentcloudapi.com\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"ru-QIWV5Vp1L6R4JOOxk5\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" max_fail_num=3, # 最大失败数,默认值5\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"5pePzlegxBxQDF1rD9VMj\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" max_fail_percent=0.5, # 最大失败率,默认值0.75。当失败数达到最大失败数,且失败率达到最大的失败率时,或者连续失败数达到5次,关闭状态切换到开启状态\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"IaNV8m2JV_NRRYWD_X9d0\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" window_interval=60, # 计数窗口,单位s,默认300。处于关闭状态时,时间超过窗口则重新计数\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"VBNqri9jS2DLzC8MDrAjY\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" timeout=30, # 全开时间,单位s,默认60。处于全开状态达到超过该时间,切换为半开状态\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"sj6RFgHyS8lcNaiyp9oNE\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\" max_requests=3 # 最大成功请求数,默认5。处于半开状态时,请求主域名达到该数量则切换为关闭状态\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"Lgz49wWCKXBTA16JQamyY\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\")\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"CDd7CnEWPMXonMHDL_wbq\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"clientProfile = ClientProfile()\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"thssQdpsxcxBy4OPssevJ\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"clientProfile.disable_region_breaker = False # 使用地域容灾必须要将这个值置为false\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"DpsIQGiRqeBp-u6XE0z8B\\\\\\\"},{\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"clientProfile.region_breaker_profile = regionBreakerProfile\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-line\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"T5dL9cg-g2xQA2HwgVjwn\\\\\\\"}],\\\\\\\"type\\\\\\\":\\\\\\\"code-block\\\\\\\",\\\\\\\"language\\\\\\\":\\\\\\\"python\\\\\\\",\\\\\\\"id\\\\\\\":\\\\\\\"tQX_jV96aRsx9OEVFFCCx\\\\\\\",\\\\\\\"autoWrap\\\\\\\":false},{\\\\\\\"type\\\\\\\":\\\\\\\"p\\\\\\\",\\\\\\\"children\\\\\\\":[{\\\\\\\"text\\\\\\\":\\\\\\\"\\\\\\\"}],\\\\\\\"id\\\\\\\":\\\\\\\"ClSWLUK5K2WyjS7Xa3Dw7\\\\\\\"}]\\\"\",\"sdkPath\":\"//qcloudimg.tencent-cloud.cn/static/document/tea-slate-sdk.v0.1.16-fix-v5\"},\"relationConfig\":{\"switch\":0},\"shareConfig\":[],\"advanced\":[]},\"relatedHotArticleList\":[]},\"staticContext\":{\"isMobile\":false,\"isMiniProgram\":false,\"isWechat\":false,\"isPreview\":false,\"originalUrl\":\"/document/sdk/Python\",\"CDN_DOMAIN\":\"cloudcache.tencent-cloud.com\",\"QCLOUD_DOMAIN\":\"cloud.tencent.com\",\"isLegalReferer\":true,\"ssrInfo\":{},\"language\":\"zh\",\"requestId\":\"1TpQeYFiYo\"}},\"0-0\":null},\"actionData\":null,\"errors\":null}");</script></div><script>window.isServerContext = false; window.isClientContext = true; window.$serverTime = 1732704569202; window.$clientTime = 1732704569202;</script><script> window.CDN_DOMAIN = 'cloudcache.tencent-cloud.com'; window.QCLOUD_DOMAIN = 'cloud.tencent.com'; window.language = 'zh'; </script><script src="//cloudcache.tencent-cloud.com/qcloud/developer/scripts/release/libs/dom4/1.8.3/dom4.js"></script><script src="//cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/raf/raf.js"></script><script>if (window.raf) window.raf.polyfill()</script><script src="//cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/libs/jsencrypt-standalone.min.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/babel/polyfill.6.26.min.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/react/react.16.8.6.min.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/react/react-dom.16.8.6.min.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/jquery-3.2.1.min.js"></script><div> <script> window.__QCPortalContext__ = { version: "0.4.0", resource: {}, $getCurrServerTime: (function(s, c) {return function(){return +new Date()+s-c;}})(1732704569202, +new Date()), } </script> <script src="https://cloudcache.tencent-cloud.com/qcloud/portal/kit/full.c9aa1f7ce.js"></script> <script> if (window.QCPortalKit) { window.QCPortalKit.init({"topNav":{"fixed":true},"footer":{"mobileOnly":true},"floatBar":{"disable":true},"version":"v2","site":{"replaceUrlTLDScope":"page"}}) } </script> </div><script src="//cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/login/api.js"></script><script src="//cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/vendors/clipboard.min.js"></script><script src="//cloudcache.tencent-cloud.com/qcloud/main/components/document-feedback/document-feedback.1067f5e58e.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/doc/scripts/document/app.4550c09c.js"></script><script src="https://cloudcache.tencent-cloud.com/qcloud/main/scripts/release/common/deps/wechatJsSdk.js?version=1_0_1&amp;max_age=31536000"></script><script>window.$render();</script><script src="//dscache.tencent-cloud.cn/ecache/qcstat/qcloud/qcloudStatApi.js" async=""></script></body></html>

Pages: 1 2 3 4 5 6 7 8 9 10