tencentcloud-sdk-python 3.0.1338__py2.py3-none-any.whl → 3.0.1372__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tencentcloud/__init__.py +1 -1
- tencentcloud/advisor/v20200721/models.py +0 -26
- tencentcloud/ams/v20201229/ams_client.py +17 -6
- tencentcloud/ams/v20201229/models.py +8 -6
- tencentcloud/antiddos/v20200309/antiddos_client.py +0 -50
- tencentcloud/antiddos/v20200309/models.py +44 -837
- tencentcloud/apm/v20210622/models.py +60 -60
- tencentcloud/autoscaling/v20180419/autoscaling_client.py +28 -1
- tencentcloud/autoscaling/v20180419/models.py +352 -210
- tencentcloud/batch/v20170312/batch_client.py +0 -46
- tencentcloud/batch/v20170312/errorcodes.py +0 -9
- tencentcloud/batch/v20170312/models.py +44 -1179
- tencentcloud/bh/v20230418/bh_client.py +253 -0
- tencentcloud/bh/v20230418/errorcodes.py +15 -0
- tencentcloud/bh/v20230418/models.py +3489 -1335
- tencentcloud/bi/v20220105/models.py +242 -2
- tencentcloud/billing/v20180709/billing_client.py +0 -23
- tencentcloud/billing/v20180709/models.py +34 -926
- tencentcloud/bpaas/v20181217/models.py +0 -54
- tencentcloud/cam/v20190116/errorcodes.py +3 -0
- tencentcloud/cam/v20190116/models.py +2 -86
- tencentcloud/captcha/v20190722/models.py +21 -54
- tencentcloud/cat/v20180409/cat_client.py +23 -0
- tencentcloud/cat/v20180409/models.py +509 -0
- tencentcloud/cbs/v20170312/cbs_client.py +1 -1
- tencentcloud/cbs/v20170312/models.py +75 -96
- tencentcloud/ccc/v20200210/ccc_client.py +184 -0
- tencentcloud/ccc/v20200210/errorcodes.py +12 -0
- tencentcloud/ccc/v20200210/models.py +2552 -1026
- tencentcloud/cdb/v20170320/cdb_client.py +27 -4
- tencentcloud/cdb/v20170320/models.py +180 -20
- tencentcloud/cdc/v20201214/cdc_client.py +46 -0
- tencentcloud/cdc/v20201214/errorcodes.py +18 -0
- tencentcloud/cdc/v20201214/models.py +202 -86
- tencentcloud/cdn/v20180606/cdn_client.py +70 -24
- tencentcloud/cdn/v20180606/models.py +19 -50
- tencentcloud/cdwch/v20200915/errorcodes.py +15 -0
- tencentcloud/cdwch/v20200915/models.py +242 -260
- tencentcloud/cdwdoris/v20211228/models.py +330 -0
- tencentcloud/cdwpg/v20201230/models.py +196 -516
- tencentcloud/cdz/v20221123/models.py +0 -12
- tencentcloud/cfg/v20210820/models.py +30 -198
- tencentcloud/cfs/v20190719/errorcodes.py +3 -0
- tencentcloud/cfs/v20190719/models.py +15 -0
- tencentcloud/cfw/v20190904/cfw_client.py +23 -0
- tencentcloud/cfw/v20190904/models.py +331 -4
- tencentcloud/chc/__init__.py +0 -0
- tencentcloud/chc/v20230418/__init__.py +0 -0
- tencentcloud/chc/v20230418/chc_client.py +877 -0
- tencentcloud/chc/v20230418/errorcodes.py +15 -0
- tencentcloud/chc/v20230418/models.py +10146 -0
- tencentcloud/chdfs/v20201112/models.py +2 -2
- tencentcloud/ckafka/v20190819/ckafka_client.py +46 -0
- tencentcloud/ckafka/v20190819/models.py +371 -1230
- tencentcloud/clb/v20180317/clb_client.py +3 -3
- tencentcloud/clb/v20180317/models.py +395 -406
- tencentcloud/cls/v20201016/cls_client.py +41 -18
- tencentcloud/cls/v20201016/models.py +256 -606
- tencentcloud/cme/v20191029/cme_client.py +0 -1
- tencentcloud/cme/v20191029/errorcodes.py +3 -0
- tencentcloud/cme/v20191029/models.py +10 -14
- tencentcloud/cmq/v20190304/models.py +0 -90
- tencentcloud/common/abstract_client.py +29 -24
- tencentcloud/common/abstract_model.py +5 -1
- tencentcloud/common/common_client.py +14 -15
- tencentcloud/common/credential.py +68 -65
- tencentcloud/common/exception/tencent_cloud_sdk_exception.py +1 -1
- tencentcloud/common/profile/client_profile.py +32 -30
- tencentcloud/common/profile/http_profile.py +20 -12
- tencentcloud/common/retry.py +18 -0
- tencentcloud/controlcenter/v20230110/models.py +0 -58
- tencentcloud/cvm/v20170312/cvm_client.py +42 -10
- tencentcloud/cvm/v20170312/errorcodes.py +25 -1
- tencentcloud/cvm/v20170312/models.py +835 -290
- tencentcloud/cwp/v20180228/cwp_client.py +1 -1
- tencentcloud/cwp/v20180228/models.py +362 -58
- tencentcloud/cynosdb/v20190107/cynosdb_client.py +69 -0
- tencentcloud/cynosdb/v20190107/models.py +451 -824
- tencentcloud/dbbrain/v20191016/dbbrain_client.py +23 -0
- tencentcloud/dbbrain/v20191016/models.py +605 -52
- tencentcloud/dbbrain/v20210527/dbbrain_client.py +322 -0
- tencentcloud/dbbrain/v20210527/models.py +6071 -2974
- tencentcloud/dbdc/v20201029/models.py +0 -16
- tencentcloud/dc/v20180410/models.py +25 -12
- tencentcloud/dcdb/v20180411/errorcodes.py +3 -0
- tencentcloud/dcdb/v20180411/models.py +175 -114
- tencentcloud/dlc/v20210125/dlc_client.py +69 -0
- tencentcloud/dlc/v20210125/errorcodes.py +3 -0
- tencentcloud/dlc/v20210125/models.py +1217 -592
- tencentcloud/dnspod/v20210323/dnspod_client.py +69 -0
- tencentcloud/dnspod/v20210323/errorcodes.py +9 -0
- tencentcloud/dnspod/v20210323/models.py +718 -110
- tencentcloud/domain/v20180808/domain_client.py +4 -2
- tencentcloud/domain/v20180808/errorcodes.py +3 -0
- tencentcloud/domain/v20180808/models.py +628 -324
- tencentcloud/dsgc/v20190723/dsgc_client.py +0 -23
- tencentcloud/dsgc/v20190723/models.py +53 -34
- tencentcloud/dts/v20180330/models.py +0 -10
- tencentcloud/dts/v20211206/models.py +118 -585
- tencentcloud/ecdn/v20191012/ecdn_client.py +24 -225
- tencentcloud/ecdn/v20191012/errorcodes.py +0 -63
- tencentcloud/ecdn/v20191012/models.py +4 -1047
- tencentcloud/emr/v20190103/emr_client.py +47 -1
- tencentcloud/emr/v20190103/models.py +1174 -146
- tencentcloud/es/v20180416/errorcodes.py +3 -0
- tencentcloud/es/v20180416/models.py +74 -6
- tencentcloud/es/v20250101/__init__.py +0 -0
- tencentcloud/es/v20250101/errorcodes.py +45 -0
- tencentcloud/es/v20250101/es_client.py +251 -0
- tencentcloud/es/v20250101/models.py +2519 -0
- tencentcloud/ess/v20201111/ess_client.py +43 -5
- tencentcloud/ess/v20201111/models.py +854 -60
- tencentcloud/essbasic/v20210526/essbasic_client.py +35 -2
- tencentcloud/essbasic/v20210526/models.py +726 -43
- tencentcloud/facefusion/v20220927/models.py +4 -2
- tencentcloud/fmu/v20191213/errorcodes.py +3 -21
- tencentcloud/fmu/v20191213/fmu_client.py +0 -75
- tencentcloud/fmu/v20191213/models.py +4 -531
- tencentcloud/gaap/v20180529/gaap_client.py +1 -1
- tencentcloud/gaap/v20180529/models.py +2 -276
- tencentcloud/goosefs/v20220519/models.py +0 -2
- tencentcloud/gs/v20191118/errorcodes.py +36 -0
- tencentcloud/gs/v20191118/gs_client.py +1074 -12
- tencentcloud/gs/v20191118/models.py +6976 -492
- tencentcloud/gwlb/v20240906/errorcodes.py +3 -0
- tencentcloud/gwlb/v20240906/gwlb_client.py +5 -8
- tencentcloud/gwlb/v20240906/models.py +94 -84
- tencentcloud/hai/v20230812/errorcodes.py +7 -1
- tencentcloud/hai/v20230812/hai_client.py +23 -0
- tencentcloud/hai/v20230812/models.py +111 -136
- tencentcloud/hunyuan/v20230901/errorcodes.py +27 -0
- tencentcloud/hunyuan/v20230901/hunyuan_client.py +71 -0
- tencentcloud/hunyuan/v20230901/models.py +1089 -119
- tencentcloud/ims/v20201229/models.py +25 -4
- tencentcloud/ioa/v20220601/ioa_client.py +92 -0
- tencentcloud/ioa/v20220601/models.py +1136 -225
- tencentcloud/iotcloud/v20210408/models.py +2 -4
- tencentcloud/iotexplorer/v20190423/errorcodes.py +12 -0
- tencentcloud/iotexplorer/v20190423/iotexplorer_client.py +234 -52
- tencentcloud/iotexplorer/v20190423/models.py +2906 -1063
- tencentcloud/iotvideo/v20191126/models.py +0 -4
- tencentcloud/iotvideo/v20201215/models.py +17 -0
- tencentcloud/iotvideo/v20211125/iotvideo_client.py +69 -0
- tencentcloud/iotvideo/v20211125/models.py +476 -0
- tencentcloud/iotvideoindustry/v20201201/iotvideoindustry_client.py +2 -2
- tencentcloud/iotvideoindustry/v20201201/models.py +30 -486
- tencentcloud/iss/v20230517/errorcodes.py +9 -0
- tencentcloud/iss/v20230517/iss_client.py +161 -0
- tencentcloud/iss/v20230517/models.py +1716 -743
- tencentcloud/kms/v20190118/models.py +101 -0
- tencentcloud/lcic/v20220817/errorcodes.py +2 -2
- tencentcloud/lcic/v20220817/lcic_client.py +47 -1
- tencentcloud/lcic/v20220817/models.py +357 -72
- tencentcloud/lighthouse/v20200324/errorcodes.py +12 -15
- tencentcloud/lighthouse/v20200324/lighthouse_client.py +39 -76
- tencentcloud/lighthouse/v20200324/models.py +237 -259
- tencentcloud/live/v20180801/models.py +61 -46
- tencentcloud/lke/v20231130/errorcodes.py +3 -0
- tencentcloud/lke/v20231130/lke_client.py +8 -29
- tencentcloud/lke/v20231130/models.py +561 -115
- tencentcloud/lkeap/v20240522/lkeap_client.py +33 -4
- tencentcloud/lkeap/v20240522/models.py +290 -18
- tencentcloud/lowcode/v20210108/errorcodes.py +3 -0
- tencentcloud/lowcode/v20210108/models.py +0 -2
- tencentcloud/mariadb/v20170312/models.py +155 -140
- tencentcloud/memcached/v20190318/models.py +2 -2
- tencentcloud/mmps/v20200710/models.py +0 -66
- tencentcloud/mna/v20210119/errorcodes.py +0 -36
- tencentcloud/mna/v20210119/mna_client.py +0 -75
- tencentcloud/mna/v20210119/models.py +0 -1002
- tencentcloud/mongodb/v20190725/models.py +115 -6
- tencentcloud/mongodb/v20190725/mongodb_client.py +23 -0
- tencentcloud/monitor/v20180724/errorcodes.py +3 -0
- tencentcloud/monitor/v20180724/models.py +1055 -74
- tencentcloud/monitor/v20180724/monitor_client.py +94 -2
- tencentcloud/mps/v20190612/errorcodes.py +36 -0
- tencentcloud/mps/v20190612/models.py +4866 -448
- tencentcloud/mps/v20190612/mps_client.py +208 -0
- tencentcloud/mqtt/v20240516/errorcodes.py +15 -0
- tencentcloud/mqtt/v20240516/models.py +705 -372
- tencentcloud/mqtt/v20240516/mqtt_client.py +4 -4
- tencentcloud/oceanus/v20190422/models.py +14 -2
- tencentcloud/ocr/v20181119/errorcodes.py +0 -12
- tencentcloud/ocr/v20181119/models.py +311 -1042
- tencentcloud/ocr/v20181119/ocr_client.py +5 -102
- tencentcloud/organization/v20210331/errorcodes.py +3 -0
- tencentcloud/organization/v20210331/models.py +45 -82
- tencentcloud/partners/v20180321/models.py +169 -0
- tencentcloud/partners/v20180321/partners_client.py +23 -0
- tencentcloud/postgres/v20170312/models.py +36 -328
- tencentcloud/postgres/v20170312/postgres_client.py +15 -5
- tencentcloud/privatedns/v20201028/models.py +36 -28
- tencentcloud/rce/v20201103/models.py +0 -15
- tencentcloud/redis/v20180412/models.py +233 -18
- tencentcloud/redis/v20180412/redis_client.py +23 -0
- tencentcloud/rum/v20210622/models.py +0 -2
- tencentcloud/ses/v20201002/models.py +32 -4
- tencentcloud/smop/v20201203/smop_client.py +3 -1
- tencentcloud/soe/v20180724/models.py +4 -2
- tencentcloud/sqlserver/v20180328/models.py +75 -0
- tencentcloud/ssl/v20191205/models.py +7 -319
- tencentcloud/ssm/v20190923/models.py +45 -0
- tencentcloud/sts/v20180813/errorcodes.py +9 -0
- tencentcloud/sts/v20180813/models.py +171 -0
- tencentcloud/sts/v20180813/sts_client.py +23 -0
- tencentcloud/svp/v20240125/errorcodes.py +3 -0
- tencentcloud/svp/v20240125/models.py +506 -44
- tencentcloud/svp/v20240125/svp_client.py +23 -0
- tencentcloud/tan/v20220420/tan_client.py +3 -1
- tencentcloud/tat/v20201028/errorcodes.py +12 -0
- tencentcloud/tat/v20201028/models.py +138 -42
- tencentcloud/tbaas/v20180416/models.py +0 -58
- tencentcloud/tcb/v20180608/errorcodes.py +3 -0
- tencentcloud/tcb/v20180608/models.py +189 -582
- tencentcloud/tcb/v20180608/tcb_client.py +23 -23
- tencentcloud/tcbr/v20220217/models.py +45 -0
- tencentcloud/tchd/v20230306/models.py +166 -0
- tencentcloud/tchd/v20230306/tchd_client.py +24 -0
- tencentcloud/tcr/v20190924/models.py +44 -174
- tencentcloud/tcss/v20201101/models.py +1458 -2066
- tencentcloud/tcss/v20201101/tcss_client.py +92 -125
- tencentcloud/tdid/v20210519/models.py +0 -10
- tencentcloud/tdmq/v20200217/models.py +405 -575
- tencentcloud/tdmq/v20200217/tdmq_client.py +12 -54
- tencentcloud/tds/v20220801/models.py +441 -0
- tencentcloud/tds/v20220801/tds_client.py +23 -0
- tencentcloud/tem/v20210701/models.py +0 -498
- tencentcloud/teo/v20220106/teo_client.py +6 -2
- tencentcloud/teo/v20220901/errorcodes.py +9 -0
- tencentcloud/teo/v20220901/models.py +1828 -472
- tencentcloud/teo/v20220901/teo_client.py +54 -4
- tencentcloud/thpc/v20211109/models.py +0 -6
- tencentcloud/thpc/v20220401/models.py +0 -14
- tencentcloud/thpc/v20230321/models.py +64 -52
- tencentcloud/tione/v20211111/errorcodes.py +114 -0
- tencentcloud/tione/v20211111/models.py +2288 -160
- tencentcloud/tione/v20211111/tione_client.py +138 -0
- tencentcloud/tiw/v20190919/errorcodes.py +3 -24
- tencentcloud/tiw/v20190919/models.py +3657 -8172
- tencentcloud/tiw/v20190919/tiw_client.py +1 -580
- tencentcloud/tke/v20180525/models.py +705 -721
- tencentcloud/tke/v20180525/tke_client.py +23 -0
- tencentcloud/tke/v20220501/models.py +0 -34
- tencentcloud/trocket/v20230308/models.py +1630 -160
- tencentcloud/trocket/v20230308/trocket_client.py +238 -0
- tencentcloud/trro/v20220325/models.py +1132 -44
- tencentcloud/trro/v20220325/trro_client.py +142 -0
- tencentcloud/trtc/v20190722/models.py +94 -90
- tencentcloud/trtc/v20190722/trtc_client.py +4 -0
- tencentcloud/tse/v20201207/models.py +90 -1010
- tencentcloud/tsf/v20180326/errorcodes.py +6 -0
- tencentcloud/tsf/v20180326/models.py +350 -582
- tencentcloud/tsf/v20180326/tsf_client.py +26 -1
- tencentcloud/tts/v20190823/models.py +15 -15
- tencentcloud/tts/v20190823/tts_client.py +6 -5
- tencentcloud/vclm/v20240523/models.py +2 -2
- tencentcloud/vcube/v20220410/models.py +66 -158
- tencentcloud/vcube/v20220410/vcube_client.py +2 -2
- tencentcloud/vdb/v20230616/models.py +1487 -29
- tencentcloud/vdb/v20230616/vdb_client.py +185 -1
- tencentcloud/vm/v20210922/models.py +2 -2
- tencentcloud/vm/v20210922/vm_client.py +16 -8
- tencentcloud/vod/v20180717/errorcodes.py +3 -0
- tencentcloud/vod/v20180717/models.py +106 -417
- tencentcloud/vod/v20180717/vod_client.py +2 -1
- tencentcloud/vod/v20240718/errorcodes.py +33 -0
- tencentcloud/vod/v20240718/models.py +1839 -0
- tencentcloud/vod/v20240718/vod_client.py +146 -0
- tencentcloud/vpc/v20170312/errorcodes.py +12 -0
- tencentcloud/vpc/v20170312/models.py +2052 -519
- tencentcloud/vpc/v20170312/vpc_client.py +229 -11
- tencentcloud/vrs/v20200824/models.py +49 -0
- tencentcloud/waf/v20180125/errorcodes.py +9 -0
- tencentcloud/waf/v20180125/models.py +4191 -0
- tencentcloud/waf/v20180125/waf_client.py +276 -0
- tencentcloud/wedata/v20210820/models.py +5404 -394
- tencentcloud/wedata/v20210820/wedata_client.py +161 -0
- tencentcloud/weilingwith/v20230427/models.py +0 -964
- tencentcloud/weilingwith/v20230427/weilingwith_client.py +3 -1
- {tencentcloud_sdk_python-3.0.1338.dist-info → tencentcloud_sdk_python-3.0.1372.dist-info}/METADATA +1 -1
- {tencentcloud_sdk_python-3.0.1338.dist-info → tencentcloud_sdk_python-3.0.1372.dist-info}/RECORD +284 -275
- {tencentcloud_sdk_python-3.0.1338.dist-info → tencentcloud_sdk_python-3.0.1372.dist-info}/LICENSE +0 -0
- {tencentcloud_sdk_python-3.0.1338.dist-info → tencentcloud_sdk_python-3.0.1372.dist-info}/WHEEL +0 -0
- {tencentcloud_sdk_python-3.0.1338.dist-info → tencentcloud_sdk_python-3.0.1372.dist-info}/top_level.txt +0 -0
@@ -471,20 +471,19 @@ class AbstractClient(object):
|
|
471
471
|
return resp.content
|
472
472
|
|
473
473
|
def call_octet_stream(self, action, headers, body):
|
474
|
-
"""
|
475
|
-
Invoke API with application/ocet-stream content-type.
|
474
|
+
"""Invoke API with application/ocet-stream content-type.
|
476
475
|
|
477
476
|
Note:
|
478
477
|
1. only specific API can be invoked in such manner.
|
479
478
|
2. only TC3-HMAC-SHA256 signature method can be specified.
|
480
479
|
3. only POST request method can be specified
|
481
480
|
|
482
|
-
:type action: str
|
483
481
|
:param action: Specific API action name.
|
484
|
-
:type
|
482
|
+
:type action: str
|
485
483
|
:param headers: Header parameters for this API.
|
486
|
-
:type
|
484
|
+
:type headers: dict
|
487
485
|
:param body: Bytes of requested body
|
486
|
+
:type body: bytes
|
488
487
|
"""
|
489
488
|
if self.profile.signMethod != "TC3-HMAC-SHA256":
|
490
489
|
raise SDKError("ClientError", "Invalid signature method.")
|
@@ -505,17 +504,16 @@ class AbstractClient(object):
|
|
505
504
|
return json.loads(resp.content)
|
506
505
|
|
507
506
|
def call_json(self, action, params, headers=None, options=None):
|
508
|
-
"""
|
509
|
-
Call api with json object and return with json object.
|
507
|
+
"""Call api with json object and return with json object.
|
510
508
|
|
511
|
-
:type action: str
|
512
509
|
:param action: api name e.g. ``DescribeInstances``
|
510
|
+
:type action: str
|
511
|
+
:param params: Request parameters of this action
|
513
512
|
:type params: dict
|
514
|
-
:param
|
513
|
+
:param headers: Request headers, like {"X-TC-TraceId": "ffe0c072-8a5d-4e17-8887-a8a60252abca"}
|
515
514
|
:type headers: dict
|
516
|
-
:param
|
515
|
+
:param options: Request options, like {"SkipSign": False, "IsMultipart": False, "IsOctetStream": False, "BinaryParams": []}
|
517
516
|
:type options: dict
|
518
|
-
:param options: request options, like {"SkipSign": False, "IsMultipart": False, "IsOctetStream": False, "BinaryParams": []}
|
519
517
|
"""
|
520
518
|
|
521
519
|
def _call_once():
|
@@ -529,6 +527,17 @@ class AbstractClient(object):
|
|
529
527
|
return json.loads(retryer.send_request(_call_once).content)
|
530
528
|
|
531
529
|
def call_sse(self, action, params, headers=None, options=None):
|
530
|
+
"""Call api with json object and return with sse event.
|
531
|
+
|
532
|
+
:param action: api name e.g. ``ChatCompletions``
|
533
|
+
:type action: str
|
534
|
+
:param params: Request parameters of this action
|
535
|
+
:type params: dict
|
536
|
+
:param headers: Request headers, like {"X-TC-TraceId": "ffe0c072-8a5d-4e17-8887-a8a60252abca"}
|
537
|
+
:type headers: dict
|
538
|
+
:param options: Request options, like {"SkipSign": False, "IsMultipart": False, "IsOctetStream": False, "BinaryParams": []}
|
539
|
+
:type options: dict
|
540
|
+
"""
|
532
541
|
def _call_once():
|
533
542
|
resp = self._call(action, params, options, headers)
|
534
543
|
self._check_status(resp)
|
@@ -557,15 +566,14 @@ class AbstractClient(object):
|
|
557
566
|
return self._process_response_json(resp, resp_type)
|
558
567
|
|
559
568
|
def set_stream_logger(self, stream=None, level=logging.DEBUG, log_format=None):
|
560
|
-
"""
|
561
|
-
Add a stream handler
|
569
|
+
"""Add a stream handler
|
562
570
|
|
563
|
-
:type stream: IO[str]
|
564
571
|
:param stream: e.g. ``sys.stdout`` ``sys.stdin`` ``sys.stderr``
|
565
|
-
:type
|
572
|
+
:type stream: IO[str]
|
566
573
|
:param level: Logging level, e.g. ``logging.INFO``
|
567
|
-
:type
|
574
|
+
:type level: int
|
568
575
|
:param log_format: Log message format
|
576
|
+
:type log_format: str
|
569
577
|
"""
|
570
578
|
log = logging.getLogger(LOGGER_NAME)
|
571
579
|
log.setLevel(level)
|
@@ -578,15 +586,14 @@ class AbstractClient(object):
|
|
578
586
|
log.addHandler(sh)
|
579
587
|
|
580
588
|
def set_file_logger(self, file_path, level=logging.DEBUG, log_format=None):
|
581
|
-
"""
|
582
|
-
Add a file handler
|
589
|
+
"""Add a file handler
|
583
590
|
|
584
|
-
:type file_path: str
|
585
591
|
:param file_path: path of log file
|
586
|
-
:type
|
592
|
+
:type file_path: str
|
587
593
|
:param level: Logging level, e.g. ``logging.INFO``
|
588
|
-
:type
|
594
|
+
:type level: int
|
589
595
|
:param log_format: Log message format
|
596
|
+
:type log_format: str
|
590
597
|
"""
|
591
598
|
log = logging.getLogger(LOGGER_NAME)
|
592
599
|
log.setLevel(level)
|
@@ -600,9 +607,7 @@ class AbstractClient(object):
|
|
600
607
|
log.addHandler(fh)
|
601
608
|
|
602
609
|
def set_default_logger(self):
|
603
|
-
"""
|
604
|
-
Set default log handler
|
605
|
-
"""
|
610
|
+
"""Set default log handler"""
|
606
611
|
log = logging.getLogger(LOGGER_NAME)
|
607
612
|
log.handlers = []
|
608
613
|
logger.addHandler(EmptyHandler())
|
@@ -61,7 +61,11 @@ class AbstractModel(object):
|
|
61
61
|
return json.dumps(self._serialize(allow_none=True), *args, **kwargs)
|
62
62
|
|
63
63
|
def from_json_string(self, jsonStr):
|
64
|
-
"""Deserialize a JSON formatted str to a Python object
|
64
|
+
"""Deserialize a JSON formatted str to a Python object
|
65
|
+
|
66
|
+
:param jsonStr: JSON formatted string
|
67
|
+
:type jsonStr: str
|
68
|
+
"""
|
65
69
|
params = json.loads(jsonStr)
|
66
70
|
self._deserialize(params)
|
67
71
|
|
@@ -21,25 +21,24 @@ from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentClo
|
|
21
21
|
|
22
22
|
|
23
23
|
class CommonClient(AbstractClient):
|
24
|
-
"""
|
25
|
-
|
26
|
-
|
24
|
+
"""General client for all products.
|
25
|
+
|
26
|
+
With CommonClient, you only need to install the tencentcloud-sdk-python-common package to access APIs of all products.
|
27
|
+
See GitHub examples for usage details: https://github.com/TencentCloud/tencentcloud-sdk-python/tree/master/examples/common_client
|
27
28
|
|
29
|
+
:param service: Product name
|
30
|
+
:type service: str
|
31
|
+
:param version: Version of API
|
32
|
+
:type version: str
|
33
|
+
:param credential: Request credential
|
34
|
+
:type credential: tencentcloud.common.credential.Credential or tencentcloud.common.credential.STSAssumeRoleCredential or None
|
35
|
+
:param region: Request region
|
36
|
+
:type region: str
|
37
|
+
:param profile: Request SDK profile
|
38
|
+
:type profile: tencentcloud.common.profile.client_profile.ClientProfile
|
28
39
|
"""
|
29
40
|
|
30
41
|
def __init__(self, service, version, credential, region, profile=None):
|
31
|
-
"""
|
32
|
-
:param credential: 接口调用凭证
|
33
|
-
:type credential: tencentcloud.common.credential.Credential or tencentcloud.common.credential.STSAssumeRoleCredential or None
|
34
|
-
:param region: 接口调用地域
|
35
|
-
:type region: str
|
36
|
-
:param version: 接口版本
|
37
|
-
:type version: str
|
38
|
-
:param service: 接口产品
|
39
|
-
:type service: str
|
40
|
-
:param profile: 请求网络信息
|
41
|
-
:type profile: tencentcloud.common.profile.client_profile.ClientProfile
|
42
|
-
"""
|
43
42
|
if region is None or version is None or service is None:
|
44
43
|
raise TencentCloudSDKException("CommonClient Parameter Error, "
|
45
44
|
"credential region version service all required.")
|
@@ -35,20 +35,20 @@ from tencentcloud.common.profile.client_profile import ClientProfile
|
|
35
35
|
|
36
36
|
|
37
37
|
class Credential(object):
|
38
|
+
"""Tencent Cloud Credentials.
|
39
|
+
|
40
|
+
Access https://console.cloud.tencent.com/cam/capi to manage your credentials.
|
41
|
+
|
42
|
+
:param secret_id: The secret id of your credential.
|
43
|
+
:type secret_id: str
|
44
|
+
:param secret_key: The secret key of your credential.
|
45
|
+
:type secret_key: str
|
46
|
+
:param token: The federation token of your credential, if this field
|
47
|
+
is specified, secret_id and secret_key should be set
|
48
|
+
accordingly, see: https://cloud.tencent.com/document/product/598/13896
|
49
|
+
"""
|
50
|
+
|
38
51
|
def __init__(self, secret_id, secret_key, token=None):
|
39
|
-
"""Tencent Cloud Credentials.
|
40
|
-
|
41
|
-
Access https://console.cloud.tencent.com/cam/capi to manage your
|
42
|
-
credentials.
|
43
|
-
|
44
|
-
:param secret_id: The secret id of your credential.
|
45
|
-
:type secret_id: str
|
46
|
-
:param secret_key: The secret key of your credential.
|
47
|
-
:type secret_key: str
|
48
|
-
:param token: The federation token of your credential, if this field
|
49
|
-
is specified, secret_id and secret_key should be set
|
50
|
-
accordingly, see: https://cloud.tencent.com/document/product/598/13896
|
51
|
-
"""
|
52
52
|
if secret_id is None or secret_id.strip() == "":
|
53
53
|
raise TencentCloudSDKException("InvalidCredential", "secret id should not be none or empty")
|
54
54
|
if secret_id.strip() != secret_id:
|
@@ -73,6 +73,11 @@ class Credential(object):
|
|
73
73
|
|
74
74
|
|
75
75
|
class CVMRoleCredential(object):
|
76
|
+
"""Tencent Cloud Credential via CVM role
|
77
|
+
|
78
|
+
Automatically generates temporary credentials when binding a service role to instance.
|
79
|
+
See https://cloud.tencent.com/document/product/598/85616 for more information.
|
80
|
+
"""
|
76
81
|
_metadata_endpoint = "http://metadata.tencentyun.com/latest/meta-data/"
|
77
82
|
_role_endpoint = _metadata_endpoint + "cam/security-credentials/"
|
78
83
|
# In seconds.
|
@@ -156,9 +161,20 @@ class CVMRoleCredential(object):
|
|
156
161
|
|
157
162
|
|
158
163
|
class STSAssumeRoleCredential(object):
|
159
|
-
"""
|
160
|
-
|
161
|
-
|
164
|
+
"""Tencent Cloud Credential via STS service
|
165
|
+
|
166
|
+
Automatically generates temporary credentials for API calls.
|
167
|
+
|
168
|
+
:param secret_id: The secret id of your credential.
|
169
|
+
:type secret_id: str
|
170
|
+
:param secret_key: The secret key of your credential.
|
171
|
+
:type secret_key: str
|
172
|
+
:param role_arn: Resource descriptions of a role,see https://cloud.tencent.com/document/api/1312/48197
|
173
|
+
:type role_arn: str
|
174
|
+
:param role_session_name: User-defined temporary session name
|
175
|
+
:type role_session_name: str
|
176
|
+
:param duration_seconds: Specifies the validity period of credentials in seconds. Default value: 7200. Maximum value: 43200
|
177
|
+
:type duration_seconds: int
|
162
178
|
"""
|
163
179
|
_region = "ap-guangzhou"
|
164
180
|
_version = '2018-08-13'
|
@@ -167,17 +183,7 @@ class STSAssumeRoleCredential(object):
|
|
167
183
|
|
168
184
|
def __init__(self, secret_id, secret_key, role_arn, role_session_name, duration_seconds=7200, endpoint=None):
|
169
185
|
"""
|
170
|
-
|
171
|
-
:type secret_id: str
|
172
|
-
:param secret_key: 接口调用凭证key
|
173
|
-
:type secret_key: str
|
174
|
-
https://cloud.tencent.com/document/api/1312/48197
|
175
|
-
:param role_arn: 角色的资源描述,参考官网文档 https://cloud.tencent.com/document/api/1312/48197 中 RoleArn 参数的描述。
|
176
|
-
:type role_arn: str
|
177
|
-
:param role_session_name: 临时会话名称,由用户自定义名称
|
178
|
-
:type role_session_name: str
|
179
|
-
:param duration_seconds: 获取临时凭证的有效期,默认7200s
|
180
|
-
:type duration_seconds: int
|
186
|
+
|
181
187
|
"""
|
182
188
|
self._long_secret_id = secret_id
|
183
189
|
self._long_secret_key = secret_key
|
@@ -221,19 +227,6 @@ class STSAssumeRoleCredential(object):
|
|
221
227
|
return self._token
|
222
228
|
|
223
229
|
def _need_refresh(self):
|
224
|
-
"""
|
225
|
-
https://cloud.tencent.com/document/api/1312/48197
|
226
|
-
此函数自动使用初始secret_id和secret_key,自动调用上述链接中获取临时凭证的接口,并返回临时凭证
|
227
|
-
|
228
|
-
:param role_arn: 角色的资源描述,上述链接RoleArn参数中有详细获取方式
|
229
|
-
:type role_arn: str
|
230
|
-
:param role_session_name: 临时会话名称,由用户自定义名称
|
231
|
-
:type role_session_name: str
|
232
|
-
:param duration_seconds: 获取临时凭证的有效期,默认7200s
|
233
|
-
:type duration_seconds: int
|
234
|
-
|
235
|
-
"""
|
236
|
-
|
237
230
|
if None in [self._token, self._tmp_secret_key, self._tmp_secret_id] or self._expired_time < int(time.time()):
|
238
231
|
self.get_sts_tmp_role_arn()
|
239
232
|
|
@@ -260,18 +253,14 @@ class STSAssumeRoleCredential(object):
|
|
260
253
|
|
261
254
|
|
262
255
|
class EnvironmentVariableCredential(object):
|
256
|
+
"""Tencent Cloud EnvironmentVariableCredential.
|
263
257
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
credentials.
|
258
|
+
Acquire credential from environment variables.
|
259
|
+
Access https://console.cloud.tencent.com/cam/capi to manage your credentials.
|
260
|
+
Set secret id and secret key as `TENCENTCLOUD_SECRET_ID` and `TENCENTCLOUD_SECRET_KEY `in environment variables.
|
261
|
+
"""
|
269
262
|
|
270
|
-
|
271
|
-
:type secret_id: str
|
272
|
-
:param secret_key: The secret key of your credential. get by environment variable TENCENTCLOUD_SECRET_KEY
|
273
|
-
:type secret_key: str
|
274
|
-
"""
|
263
|
+
def get_credential(self):
|
275
264
|
self.secret_id = os.environ.get('TENCENTCLOUD_SECRET_ID')
|
276
265
|
self.secret_key = os.environ.get('TENCENTCLOUD_SECRET_KEY')
|
277
266
|
|
@@ -283,23 +272,17 @@ class EnvironmentVariableCredential(object):
|
|
283
272
|
|
284
273
|
|
285
274
|
class ProfileCredential(object):
|
275
|
+
"""Tencent Cloud ProfileCredential.
|
276
|
+
|
277
|
+
Access https://console.cloud.tencent.com/cam/capi to manage your credentials.
|
278
|
+
default file position is "~/.tencentcloud/credentials" or "/etc/tencentcloud/credentials", it is ini format.
|
279
|
+
such as:
|
280
|
+
[default]
|
281
|
+
secret_id=""
|
282
|
+
secret_key=""
|
283
|
+
"""
|
286
284
|
|
287
285
|
def get_credential(self):
|
288
|
-
"""Tencent Cloud ProfileCredential.
|
289
|
-
|
290
|
-
Access https://console.cloud.tencent.com/cam/capi to manage your credentials.
|
291
|
-
|
292
|
-
default file position is "~/.tencentcloud/credentials" or "/etc/tencentcloud/credentials", it is ini format.
|
293
|
-
such as:
|
294
|
-
[default]
|
295
|
-
secret_id=""
|
296
|
-
secret_key=""
|
297
|
-
|
298
|
-
:param secret_id: The secret id of your credential.
|
299
|
-
:type secret_id: str
|
300
|
-
:param secret_key: The secret key of your credential.
|
301
|
-
:type secret_key: str
|
302
|
-
"""
|
303
286
|
home_path = os.environ.get('HOME') or os.environ.get('HOMEPATH')
|
304
287
|
if os.path.exists(home_path + "/.tencentcloud/credentials"):
|
305
288
|
file_path = home_path + "/.tencentcloud/credentials"
|
@@ -371,6 +354,7 @@ class DefaultCredentialProvider(object):
|
|
371
354
|
|
372
355
|
|
373
356
|
class DefaultTkeOIDCRoleArnProvider(object):
|
357
|
+
"""Acquire credential via TKE IdP automatically."""
|
374
358
|
def get_credential(self):
|
375
359
|
return self.get_credentials()
|
376
360
|
|
@@ -382,6 +366,25 @@ class DefaultTkeOIDCRoleArnProvider(object):
|
|
382
366
|
|
383
367
|
|
384
368
|
class OIDCRoleArnCredential(object):
|
369
|
+
"""TencentCloud OIDC Credential
|
370
|
+
|
371
|
+
OIDC is an authentication protocol built on OAuth 2.0. Tencent Cloud CAM supports OIDC role-based SSO.
|
372
|
+
See https://cloud.tencent.com/document/product/598/96013 for more information.
|
373
|
+
This will apply for an OIDC role credential automatically.
|
374
|
+
|
375
|
+
:param region: Region for AssumeRoleWithWebIdentity call. See https://cloud.tencent.com/document/product/1312/73070
|
376
|
+
:type region: str
|
377
|
+
:param provider_id: Identity provider name
|
378
|
+
:type provider_id: str
|
379
|
+
:param web_identity_token: OIDC token issued by the IdP
|
380
|
+
:type web_identity_token: str
|
381
|
+
:param role_arn: Role access description name
|
382
|
+
:type role_arn: str
|
383
|
+
:param role_session_name: Session name
|
384
|
+
:type role_session_name: str
|
385
|
+
:param duration_seconds: The validity period of the temporary credential in seconds. Default value: 7200s. Maximum value: 43200s.
|
386
|
+
:type duration_seconds: int
|
387
|
+
"""
|
385
388
|
_version = '2018-08-13'
|
386
389
|
_service = "sts"
|
387
390
|
_action = 'AssumeRoleWithWebIdentity'
|
@@ -18,25 +18,27 @@ from tencentcloud.common.profile.http_profile import HttpProfile
|
|
18
18
|
|
19
19
|
|
20
20
|
class ClientProfile(object):
|
21
|
+
"""SDK profile.
|
22
|
+
|
23
|
+
:param signMethod: The signature method, valid choice: HmacSHA1, HmacSHA256, TC3-HMAC-SHA256
|
24
|
+
:type signMethod: str
|
25
|
+
:param httpProfile: The http profile
|
26
|
+
:type httpProfile: :class:`HttpProfile`
|
27
|
+
:param language: Valid choice: en-US, zh-CN.
|
28
|
+
:type language: str
|
29
|
+
:param disable_region_breaker: Switch of region breaker.
|
30
|
+
:type disable_region_breaker: bool
|
31
|
+
:param region_breaker_profile: The region breaker profile.
|
32
|
+
:type region_breaker_profile: :class:`RegionBreakerProfile`
|
33
|
+
:param request_client: Custom request client.
|
34
|
+
:type request_client: str
|
35
|
+
:param retryer: Custom retry configuration.
|
36
|
+
:type retryer: :class:`tencentcloud.common.retry.StandardRetryer`
|
37
|
+
"""
|
21
38
|
unsignedPayload = False
|
22
39
|
|
23
40
|
def __init__(self, signMethod=None, httpProfile=None, language="zh-CN",
|
24
41
|
disable_region_breaker=True, region_breaker_profile=None, request_client=None, retryer=None):
|
25
|
-
"""SDK profile.
|
26
|
-
|
27
|
-
:param signMethod: The signature method, valid choice: HmacSHA1, HmacSHA256, TC3-HMAC-SHA256
|
28
|
-
:type signMethod: str
|
29
|
-
:param httpProfile: The http profile
|
30
|
-
:type httpProfile: :class:`HttpProfile`
|
31
|
-
:param language: Valid choice: en-US, zh-CN.
|
32
|
-
:type language: str
|
33
|
-
:param disable_region_breaker: Switch of region breaker.
|
34
|
-
:type disable_region_breaker: bool
|
35
|
-
:param region_breaker_profile: The region breaker profile.
|
36
|
-
:type region_breaker_profile: :class:`RegionBreakerProfile`
|
37
|
-
:param request_client: Custom request client.
|
38
|
-
:type request_client: str
|
39
|
-
"""
|
40
42
|
self.httpProfile = HttpProfile() if httpProfile is None else httpProfile
|
41
43
|
self.signMethod = "TC3-HMAC-SHA256" if signMethod is None else signMethod
|
42
44
|
valid_language = ["zh-CN", "en-US"]
|
@@ -59,6 +61,21 @@ class ClientProfile(object):
|
|
59
61
|
|
60
62
|
|
61
63
|
class RegionBreakerProfile(object):
|
64
|
+
"""RegionBreaker profile.
|
65
|
+
|
66
|
+
:param backup_endpoint: Backup region of endpoint, default ap-guangzhou.tencentcloudapi.com.
|
67
|
+
:type backup_endpoint: str
|
68
|
+
:param max_fail_num: Max failure to trigger breaker, default 5.
|
69
|
+
:type max_fail_num: int
|
70
|
+
:param max_fail_percent: Max failure percent to trigger breaker, default 0.75.
|
71
|
+
:type max_fail_percent: float
|
72
|
+
:param window_interval: Decides when to reset counter if the state is StateClosed, default 5 minutes.
|
73
|
+
:type window_interval: int
|
74
|
+
:param timeout: Decides when to turn StateOpen to StateHalfOpen, default 60 seconds.
|
75
|
+
:type timeout: int
|
76
|
+
:param max_requests: Decides when to turn StateHalfOpen to StateClosed, default 5 successful requests.
|
77
|
+
:type max_requests: int
|
78
|
+
"""
|
62
79
|
|
63
80
|
def __init__(self, backup_endpoint="ap-guangzhou.tencentcloudapi.com",
|
64
81
|
max_fail_num=5,
|
@@ -66,21 +83,6 @@ class RegionBreakerProfile(object):
|
|
66
83
|
window_interval=60 * 5,
|
67
84
|
timeout=60,
|
68
85
|
max_requests=5):
|
69
|
-
"""RegionBreaker profile.
|
70
|
-
|
71
|
-
:param backup_endpoint: Backup region of endpoint, default ap-guangzhou.tencentcloudapi.com.
|
72
|
-
:type backup_endpoint: str
|
73
|
-
:param max_fail_num: Max failure to trigger breaker, default 5.
|
74
|
-
:type max_fail_num: int
|
75
|
-
:param max_fail_percent: Max failure percent to trigger breaker, default 0.75.
|
76
|
-
:type max_fail_percent: float
|
77
|
-
:param window_interval: Decides when to reset counter if the state is StateClosed, default 5 minutes.
|
78
|
-
:type window_interval: int
|
79
|
-
:param timeout: Decides when to turn StateOpen to StateHalfOpen, default 1 minutes.
|
80
|
-
:type timeout: int
|
81
|
-
:param max_requests: Decides when to turn StateHalfOpen to StateClosed, default 5 successful requests.
|
82
|
-
:type timeout: int
|
83
|
-
"""
|
84
86
|
self.backup_endpoint = backup_endpoint
|
85
87
|
if not self.check_endpoint():
|
86
88
|
raise TencentCloudSDKException("ClientError", "the format of `backup_endpoint` must be tencentcloudapi.com "
|
@@ -14,22 +14,30 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
class HttpProfile(object):
|
17
|
+
"""HTTP profile.
|
18
|
+
|
19
|
+
:param protocol: Request schema, http or https, default is https.
|
20
|
+
:type protocol: str
|
21
|
+
:param endpoint: The domain to access, like: cvm.tencentcloudapi.com
|
22
|
+
:type endpoint: str
|
23
|
+
:param reqMethod: The http method, valid choice: GET, POST
|
24
|
+
:type reqMethod: str
|
25
|
+
:param reqTimeout: The http timeout in second.
|
26
|
+
:type reqTimeout: int
|
27
|
+
:param keepAlive: Whether set keep alive.
|
28
|
+
:type keepAlive: bool
|
29
|
+
:param proxy: Custom proxy server, like: http(s)://{user}:{password}@{ip}:{port}.
|
30
|
+
:type proxy: str
|
31
|
+
:param rootDomain: The root domain to access, like: tencentcloudapi.com.
|
32
|
+
:type rootDomain: str
|
33
|
+
:param certification: Custom certificate path (typically not required).
|
34
|
+
Set `False` to disable certificate verification.
|
35
|
+
:type certification: str or bool
|
36
|
+
"""
|
17
37
|
scheme = "https"
|
18
38
|
|
19
39
|
def __init__(self, protocol=None, endpoint=None, reqMethod="POST", reqTimeout=60,
|
20
40
|
keepAlive=False, proxy=None, rootDomain=None, certification=None):
|
21
|
-
"""HTTP profile.
|
22
|
-
:param protocol: http or https, default is https.
|
23
|
-
:type protocol: str
|
24
|
-
:param endpoint: The domain to access, like: cvm.tencentcloudapi.com
|
25
|
-
:type endpoint: str
|
26
|
-
:param reqMethod: the http method, valid choice: GET, POST
|
27
|
-
:type reqMethod: str
|
28
|
-
:param reqTimeout: The http timeout in second.
|
29
|
-
:type reqTimeout: int
|
30
|
-
:param rootDomain: The root domain to access, like: tencentcloudapi.com.
|
31
|
-
:type rootDomain: str
|
32
|
-
"""
|
33
41
|
self.endpoint = endpoint
|
34
42
|
self.reqTimeout = 60 if reqTimeout is None else reqTimeout
|
35
43
|
self.reqMethod = "POST" if reqMethod is None else reqMethod
|
tencentcloud/common/retry.py
CHANGED
@@ -5,11 +5,29 @@ from tencentcloud.common.exception import TencentCloudSDKException
|
|
5
5
|
|
6
6
|
|
7
7
|
class NoopRetryer(object):
|
8
|
+
"""configuration without retry
|
9
|
+
|
10
|
+
NoopRetryer is a retry policy that does nothing.
|
11
|
+
It is useful when you don't want to retry.
|
12
|
+
"""
|
13
|
+
|
8
14
|
def send_request(self, fn):
|
9
15
|
return fn()
|
10
16
|
|
11
17
|
|
12
18
|
class StandardRetryer(object):
|
19
|
+
"""Retry configuration
|
20
|
+
|
21
|
+
StandardRetryer is a retry policy that retries on network errors or frequency limitation.
|
22
|
+
:param max_attempts: Maximum number of attempts.
|
23
|
+
:type max_attempts: int
|
24
|
+
:param backoff_fn: A function that takes the number of attempts and returns the number of seconds to sleep before the next retry.
|
25
|
+
Default sleep time is 2^n seconds, n is the number of attempts.
|
26
|
+
:type backoff_fn: function
|
27
|
+
:param logger: A logger to log retry attempts. If not provided, no logging will be performed.
|
28
|
+
:type logger: logging.Logger
|
29
|
+
"""
|
30
|
+
|
13
31
|
def __init__(self, max_attempts=3, backoff_fn=None, logger=None):
|
14
32
|
self._max_attempts = max_attempts
|
15
33
|
self._backoff_fn = backoff_fn or self.backoff
|