tccli 3.0.1348.1__py2.py3-none-any.whl → 3.0.1349.1__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.
- tccli/__init__.py +1 -1
- tccli/services/__init__.py +0 -76
- tccli/services/ai3d/v20250513/api.json +1 -1
- tccli/services/aiart/v20221229/api.json +3 -3
- tccli/services/autoscaling/v20180419/api.json +11 -0
- tccli/services/batch/v20170312/api.json +44 -0
- tccli/services/cdb/v20170320/api.json +8 -8
- tccli/services/cdb/v20170320/examples.json +1 -1
- tccli/services/cdn/v20180606/api.json +5 -5
- tccli/services/cdwdoris/v20211228/api.json +145 -7
- tccli/services/cfg/v20210820/api.json +20 -0
- tccli/services/cfs/v20190719/api.json +10 -10
- tccli/services/cfw/cfw_client.py +53 -0
- tccli/services/cfw/v20190904/api.json +272 -0
- tccli/services/cfw/v20190904/examples.json +8 -0
- tccli/services/csip/csip_client.py +833 -144
- tccli/services/csip/v20221121/api.json +3304 -1436
- tccli/services/csip/v20221121/examples.json +104 -0
- tccli/services/cvm/v20170312/api.json +1 -1
- tccli/services/cwp/v20180228/api.json +9 -0
- tccli/services/cwp/v20180228/examples.json +6 -0
- tccli/services/emr/v20190103/api.json +217 -2
- tccli/services/es/v20250101/api.json +22 -0
- tccli/services/ess/v20201111/api.json +10 -1
- tccli/services/essbasic/v20210526/api.json +3 -3
- tccli/services/gs/v20191118/api.json +38 -0
- tccli/services/igtm/igtm_client.py +159 -0
- tccli/services/igtm/v20231024/api.json +577 -0
- tccli/services/igtm/v20231024/examples.json +24 -0
- tccli/services/iotexplorer/v20190423/api.json +3 -3
- tccli/services/lcic/lcic_client.py +53 -0
- tccli/services/lcic/v20220817/api.json +53 -0
- tccli/services/lcic/v20220817/examples.json +8 -0
- tccli/services/live/v20180801/api.json +203 -1
- tccli/services/live/v20180801/examples.json +1 -1
- tccli/services/lke/v20231130/api.json +248 -2
- tccli/services/lke/v20231130/examples.json +1 -1
- tccli/services/lkeap/v20240522/api.json +1 -1
- tccli/services/mrs/v20200910/api.json +10 -0
- tccli/services/nlp/nlp_client.py +4 -322
- tccli/services/nlp/v20190408/api.json +0 -459
- tccli/services/nlp/v20190408/examples.json +0 -48
- tccli/services/ocr/v20181119/api.json +60 -5
- tccli/services/omics/v20221128/api.json +38 -0
- tccli/services/redis/v20180412/api.json +6 -6
- tccli/services/redis/v20180412/examples.json +1 -1
- tccli/services/ses/v20201002/api.json +100 -5
- tccli/services/tcb/v20180608/api.json +1 -1
- tccli/services/tcb/v20180608/examples.json +1 -1
- tccli/services/tdmq/v20200217/api.json +19 -0
- tccli/services/teo/teo_client.py +281 -16
- tccli/services/teo/v20220901/api.json +611 -6
- tccli/services/teo/v20220901/examples.json +48 -2
- tccli/services/tione/v20211111/api.json +16 -0
- tccli/services/tke/tke_client.py +57 -4
- tccli/services/tke/v20180525/api.json +24 -24
- tccli/services/tke/v20220501/api.json +52 -0
- tccli/services/tke/v20220501/examples.json +8 -0
- tccli/services/tmt/v20180321/api.json +4 -4
- tccli/services/tsf/v20180326/api.json +4 -4
- tccli/services/vclm/v20240523/api.json +3 -3
- tccli/services/vod/v20180717/api.json +5 -5
- tccli/services/vod/v20180717/examples.json +9 -9
- tccli/services/vpc/v20170312/api.json +1 -1
- tccli/services/vrs/v20200824/api.json +1 -1
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1349.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1349.1.dist-info}/RECORD +70 -172
- tccli/services/cis/__init__.py +0 -4
- tccli/services/cis/cis_client.py +0 -525
- tccli/services/cis/v20180408/api.json +0 -737
- tccli/services/cis/v20180408/examples.json +0 -93
- tccli/services/dataintegration/__init__.py +0 -4
- tccli/services/dataintegration/dataintegration_client.py +0 -207
- tccli/services/dataintegration/v20220613/api.json +0 -87
- tccli/services/dataintegration/v20220613/examples.json +0 -13
- tccli/services/dtf/__init__.py +0 -4
- tccli/services/dtf/dtf_client.py +0 -207
- tccli/services/dtf/v20200506/api.json +0 -274
- tccli/services/dtf/v20200506/examples.json +0 -13
- tccli/services/gpm/__init__.py +0 -4
- tccli/services/gpm/gpm_client.py +0 -1108
- tccli/services/gpm/v20200820/api.json +0 -1959
- tccli/services/gpm/v20200820/examples.json +0 -149
- tccli/services/gse/__init__.py +0 -4
- tccli/services/gse/gse_client.py +0 -4076
- tccli/services/gse/v20191112/api.json +0 -7095
- tccli/services/gse/v20191112/examples.json +0 -615
- tccli/services/iecp/__init__.py +0 -4
- tccli/services/iecp/iecp_client.py +0 -4500
- tccli/services/iecp/v20210914/api.json +0 -9770
- tccli/services/iecp/v20210914/examples.json +0 -691
- tccli/services/iir/__init__.py +0 -4
- tccli/services/iir/iir_client.py +0 -207
- tccli/services/iir/v20200417/api.json +0 -204
- tccli/services/iir/v20200417/examples.json +0 -13
- tccli/services/iottid/__init__.py +0 -4
- tccli/services/iottid/iottid_client.py +0 -631
- tccli/services/iottid/v20190411/api.json +0 -553
- tccli/services/iottid/v20190411/examples.json +0 -95
- tccli/services/mgobe/__init__.py +0 -4
- tccli/services/mgobe/mgobe_client.py +0 -530
- tccli/services/mgobe/v20190929/api.json +0 -52
- tccli/services/mgobe/v20190929/examples.json +0 -13
- tccli/services/mgobe/v20201014/api.json +0 -671
- tccli/services/mgobe/v20201014/examples.json +0 -61
- tccli/services/mvj/__init__.py +0 -4
- tccli/services/mvj/mvj_client.py +0 -207
- tccli/services/mvj/v20190926/api.json +0 -123
- tccli/services/mvj/v20190926/examples.json +0 -19
- tccli/services/pds/__init__.py +0 -4
- tccli/services/pds/pds_client.py +0 -260
- tccli/services/pds/v20210701/api.json +0 -193
- tccli/services/pds/v20210701/examples.json +0 -21
- tccli/services/smpn/__init__.py +0 -4
- tccli/services/smpn/smpn_client.py +0 -260
- tccli/services/smpn/v20190822/api.json +0 -191
- tccli/services/smpn/v20190822/examples.json +0 -21
- tccli/services/solar/__init__.py +0 -4
- tccli/services/solar/solar_client.py +0 -1055
- tccli/services/solar/v20181011/api.json +0 -1760
- tccli/services/solar/v20181011/examples.json +0 -125
- tccli/services/tan/__init__.py +0 -4
- tccli/services/tan/tan_client.py +0 -207
- tccli/services/tan/v20220420/api.json +0 -65
- tccli/services/tan/v20220420/examples.json +0 -19
- tccli/services/tav/__init__.py +0 -4
- tccli/services/tav/tav_client.py +0 -366
- tccli/services/tav/v20190118/api.json +0 -262
- tccli/services/tav/v20190118/examples.json +0 -37
- tccli/services/tbm/__init__.py +0 -4
- tccli/services/tbm/tbm_client.py +0 -631
- tccli/services/tbm/v20180129/api.json +0 -1037
- tccli/services/tbm/v20180129/examples.json +0 -77
- tccli/services/tcex/__init__.py +0 -4
- tccli/services/tcex/tcex_client.py +0 -260
- tccli/services/tcex/v20200727/api.json +0 -158
- tccli/services/tcex/v20200727/examples.json +0 -21
- tccli/services/tci/__init__.py +0 -4
- tccli/services/tci/tci_client.py +0 -2327
- tccli/services/tci/v20190318/api.json +0 -4958
- tccli/services/tci/v20190318/examples.json +0 -333
- tccli/services/tic/__init__.py +0 -4
- tccli/services/tic/tic_client.py +0 -843
- tccli/services/tic/v20201117/api.json +0 -1067
- tccli/services/tic/v20201117/examples.json +0 -121
- tccli/services/ticm/__init__.py +0 -4
- tccli/services/ticm/ticm_client.py +0 -313
- tccli/services/ticm/v20181127/api.json +0 -1391
- tccli/services/ticm/v20181127/examples.json +0 -53
- tccli/services/tics/__init__.py +0 -4
- tccli/services/tics/tics_client.py +0 -366
- tccli/services/tics/v20181115/api.json +0 -694
- tccli/services/tics/v20181115/examples.json +0 -37
- tccli/services/tiems/__init__.py +0 -4
- tccli/services/tiems/tiems_client.py +0 -1479
- tccli/services/tiems/v20190416/api.json +0 -3144
- tccli/services/tiems/v20190416/examples.json +0 -217
- tccli/services/trdp/__init__.py +0 -4
- tccli/services/trdp/trdp_client.py +0 -207
- tccli/services/trdp/v20220726/api.json +0 -843
- tccli/services/trdp/v20220726/examples.json +0 -13
- tccli/services/ump/__init__.py +0 -4
- tccli/services/ump/ump_client.py +0 -1055
- tccli/services/ump/v20200918/api.json +0 -2168
- tccli/services/ump/v20200918/examples.json +0 -141
- tccli/services/youmall/__init__.py +0 -4
- tccli/services/youmall/v20180228/api.json +0 -3572
- tccli/services/youmall/v20180228/examples.json +0 -313
- tccli/services/youmall/youmall_client.py +0 -1797
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1349.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1349.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1348.1.dist-info → tccli-3.0.1349.1.dist-info}/license_files/LICENSE +0 -0
@@ -1,53 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"actions": {
|
3
|
-
"DescribeVideoTask": [
|
4
|
-
{
|
5
|
-
"document": "",
|
6
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeVideoTask\n<公共请求参数>\n\n{\n \"VodTaskId\": \"1254418846-procedurev2-62ba01a42e723df00a8807c84f728b54t0\"\n}",
|
7
|
-
"output": "{\n \"Response\": {\n \"PornResult\": {\n \"Confidence\": 0,\n \"Suggestion\": \"pass\",\n \"Label\": \"\",\n \"SegmentSet\": [],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"TerrorismResult\": {\n \"Confidence\": 0,\n \"Suggestion\": \"pass\",\n \"Label\": \"\",\n \"SegmentSet\": [],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"PoliticalResult\": {\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Label\": \"violation_photo\",\n \"SegmentSet\": [\n {\n \"StartTimeOffset\": 1,\n \"EndTimeOffset\": 35,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_1000.jpg\",\n \"AreaCoordSet\": [\n 533,\n 15,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 37,\n \"EndTimeOffset\": 37,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_37000.jpg\",\n \"AreaCoordSet\": [\n 536,\n 18,\n 572,\n 53\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 38,\n \"EndTimeOffset\": 73,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_38000.jpg\",\n \"AreaCoordSet\": [\n 532,\n 15,\n 572,\n 53\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 74,\n \"EndTimeOffset\": 74,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_74000.jpg\",\n \"AreaCoordSet\": [\n 536,\n 16,\n 572,\n 52\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 75,\n \"EndTimeOffset\": 90,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_75000.jpg\",\n \"AreaCoordSet\": [\n 533,\n 15,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 93,\n \"EndTimeOffset\": 94,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_93000.jpg\",\n \"AreaCoordSet\": [\n 535,\n 17,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 97,\n \"EndTimeOffset\": 99,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_97000.jpg\",\n \"AreaCoordSet\": [\n 533,\n 15,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 100,\n \"EndTimeOffset\": 106,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_100000.jpg\",\n \"AreaCoordSet\": [\n 535,\n 17,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n },\n {\n \"StartTimeOffset\": 107,\n \"EndTimeOffset\": 117,\n \"Confidence\": 99,\n \"Suggestion\": \"block\",\n \"Name\": \"新唐人\",\n \"Label\": \"violation_photo\",\n \"Url\": \"http://251000800.vod2.myqcloud.com/1a168d62vodcq251000800/3eb99a035285890789088951756/645416944_107000.jpg\",\n \"AreaCoordSet\": [\n 533,\n 15,\n 572,\n 54\n ],\n \"PicUrlExpireTimeStamp\": 1558425271\n }\n ],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"PoliticalOcrResult\": {\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"SegmentSet\": [\n {\n \"StartTimeOffset\": 1,\n \"EndTimeOffset\": 1,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 3,\n \"EndTimeOffset\": 3,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 9,\n \"EndTimeOffset\": 9,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 10,\n \"EndTimeOffset\": 10,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 41,\n \"EndTimeOffset\": 41,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 42,\n \"EndTimeOffset\": 42,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 43,\n \"EndTimeOffset\": 43,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 44,\n \"EndTimeOffset\": 44,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 45,\n \"EndTimeOffset\": 45,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 46,\n \"EndTimeOffset\": 46,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 47,\n \"EndTimeOffset\": 47,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 48,\n \"EndTimeOffset\": 48,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 75,\n \"EndTimeOffset\": 75,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 76,\n \"EndTimeOffset\": 76,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 77,\n \"EndTimeOffset\": 77,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 78,\n \"EndTimeOffset\": 78,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 79,\n \"EndTimeOffset\": 79,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 86,\n \"EndTimeOffset\": 86,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 87,\n \"EndTimeOffset\": 87,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 97,\n \"EndTimeOffset\": 97,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 98,\n \"EndTimeOffset\": 98,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 99,\n \"EndTimeOffset\": 99,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 254,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 114,\n \"EndTimeOffset\": 114,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 115,\n \"EndTimeOffset\": 115,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 116,\n \"EndTimeOffset\": 116,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n },\n {\n \"StartTimeOffset\": 117,\n \"EndTimeOffset\": 117,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"中國禁聞\"\n ],\n \"AreaCoordSet\": [\n 113,\n 258,\n 228,\n 290\n ]\n }\n ],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"PornOcrResult\": {\n \"Confidence\": 0,\n \"Suggestion\": \"pass\",\n \"SegmentSet\": [],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"PornAsrResult\": {\n \"Confidence\": 0,\n \"Suggestion\": \"pass\",\n \"SegmentSet\": [],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"PoliticalAsrResult\": {\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"SegmentSet\": [\n {\n \"StartTimeOffset\": 3.53,\n \"EndTimeOffset\": 8.28,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 25.85,\n \"EndTimeOffset\": 32.3,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 35.6,\n \"EndTimeOffset\": 40.73,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 51.72,\n \"EndTimeOffset\": 55.75,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 59.28,\n \"EndTimeOffset\": 65.17,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 69.36,\n \"EndTimeOffset\": 70.79,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 73.96,\n \"EndTimeOffset\": 77.67,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n },\n {\n \"StartTimeOffset\": 91.09,\n \"EndTimeOffset\": 96.61,\n \"Confidence\": 100,\n \"Suggestion\": \"block\",\n \"KeywordSet\": [\n \"法轮功\"\n ]\n }\n ],\n \"Code\": 0,\n \"Msg\": \"\",\n \"Status\": \"SUCCESS\"\n },\n \"Status\": \"FINISH\",\n \"BeginProcessTime\": \"2019-05-14T07:53:40Z\",\n \"FinishTime\": \"2019-05-14T07:54:32Z\",\n \"RequestId\": \"02f1733c-1bfe-49ed-9e72-8ecd6ba058dd\"\n }\n}",
|
8
|
-
"title": "查询视频审核任务的审核结果"
|
9
|
-
}
|
10
|
-
],
|
11
|
-
"ImageModeration": [
|
12
|
-
{
|
13
|
-
"document": "例:同时调用色情识别、暴恐识别和政治敏感识别,返回结果均为成功。",
|
14
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ImageModeration\n<公共请求参数>\n\n{\n \"ImageUrl\": \"https://xx/a.jpg\",\n \"Config\": \"\",\n \"Scenes\": [\n \"PORN\",\n \"POLITICS\",\n \"TERRORISM\"\n ]\n}",
|
15
|
-
"output": "{\n \"Response\": {\n \"Suggestion\": \"REVIEW\",\n \"PornResult\": {\n \"Code\": 0,\n \"Msg\": \"OK\",\n \"Suggestion\": \"PASS\",\n \"Confidence\": 83,\n \"AdvancedInfo\": \"\",\n \"Type\": \"LABEL\"\n },\n \"PoliticsResult\": {\n \"Code\": 0,\n \"Msg\": \"OK\",\n \"Suggestion\": \"PASS\",\n \"Confidence\": 8,\n \"FaceResults\": [\n {\n \"FaceRect\": {\n \"Height\": 221,\n \"Width\": 221,\n \"X\": 98,\n \"Y\": 115\n },\n \"Candidates\": [\n {\n \"Name\": \"本拉登\",\n \"Confidence\": 8\n }\n ]\n }\n ],\n \"Type\": \"FACE\"\n },\n \"TerrorismResult\": {\n \"Code\": 0,\n \"Msg\": \"OK\",\n \"Suggestion\": \"REVIEW\",\n \"Confidence\": 42,\n \"AdvancedInfo\": \"\",\n \"FaceResults\": [],\n \"Type\": \"LABEL\"\n },\n \"Extra\": \"\",\n \"RequestId\": \"02f1733c-1bfe-49ed-9e72-8ecd6ba058dd\"\n }\n}",
|
16
|
-
"title": "多个识别场景调用都成功"
|
17
|
-
},
|
18
|
-
{
|
19
|
-
"document": "例:只调用其中的色情识别,返回结果为成功。",
|
20
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ImageModeration\n<公共请求参数>\n\n{\n \"ImageUrl\": \"https://porn.jpg\",\n \"Config\": \"\",\n \"Scenes\": [\n \"PORN\"\n ]\n}",
|
21
|
-
"output": "{\n \"Response\": {\n \"Suggestion\": \"PASS\",\n \"PornResult\": {\n \"Code\": 0,\n \"Msg\": \"OK\",\n \"Suggestion\": \"PASS\",\n \"Confidence\": 0,\n \"AdvancedInfo\": \"\",\n \"Type\": \"LABEL\"\n },\n \"PoliticsResult\": null,\n \"TerrorismResult\": null,\n \"Extra\": \"\",\n \"RequestId\": \"5a645a08-2e2b-4979-9815-1f2c00c2304e\"\n }\n}",
|
22
|
-
"title": "部分识别场景调用都成功"
|
23
|
-
},
|
24
|
-
{
|
25
|
-
"document": "例:只调用其中的色情识别,返回结果为失败,Code 不为0。",
|
26
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ImageModeration\n<公共请求参数>\n\n{\n \"ImageUrl\": \"https://porn.jpg\",\n \"Config\": \"\",\n \"Scenes\": [\n \"PORN\"\n ]\n}",
|
27
|
-
"output": "{\n \"Response\": {\n \"Suggestion\": \"\",\n \"PornResult\": {\n \"Code\": -1,\n \"Msg\": \"内部错误\",\n \"Suggestion\": \"\",\n \"Confidence\": 0,\n \"AdvancedInfo\": \"\",\n \"Type\": \"LABEL\"\n },\n \"PoliticsResult\": null,\n \"TerrorismResult\": null,\n \"Extra\": \"\",\n \"RequestId\": \"3854392b-19d4-4cae-8933-b010cd087c84\"\n }\n}",
|
28
|
-
"title": "部分识别场景调用失败"
|
29
|
-
},
|
30
|
-
{
|
31
|
-
"document": "例:同时调用色情识别和暴恐识别,其中色情识别的结果为失败(Code非0),暴恐识别的结果为成功。",
|
32
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ImageModeration\n<公共请求参数>\n\n{\n \"ImageUrl\": \"https://fack.jpg\",\n \"Config\": \"\",\n \"Scenes\": [\n \"PORN\",\n \"TERRORISM\"\n ]\n}",
|
33
|
-
"output": "{\n \"Response\": {\n \"Suggestion\": \"REVIEW\",\n \"PornResult\": {\n \"Code\": -1,\n \"Msg\": \"内部错误\",\n \"Suggestion\": \"\",\n \"Confidence\": 0,\n \"AdvancedInfo\": \"\",\n \"Type\": \"LABEL\"\n },\n \"TerrorismResult\": {\n \"Code\": 0,\n \"Msg\": \"OK\",\n \"Suggestion\": \"REVIEW\",\n \"Confidence\": 44,\n \"AdvancedInfo\": \"\",\n \"Type\": \"LABEL\",\n \"FaceResults\": []\n },\n \"PoliticsResult\": null,\n \"Extra\": \"\",\n \"RequestId\": \"547d2427-2f82-4d8d-99e0-f2a504619661\"\n }\n}",
|
34
|
-
"title": "部分识别场景调用且部分成功"
|
35
|
-
},
|
36
|
-
{
|
37
|
-
"document": "例:调用部分识别场景或者全部场景,由于下载等原因,导致整体结果失败。",
|
38
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ImageModeration\n<公共请求参数>\n\n{\n \"ImageUrl\": \"https://error.jpg\",\n \"Config\": \"\",\n \"Scenes\": [\n \"PORN\",\n \"POLITICS\",\n \"TERRORISM\"\n ]\n}",
|
39
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"5f77ef5e-f381-49af-89bf-e558b25b3c15\"\n }\n}",
|
40
|
-
"title": "整体结果失败"
|
41
|
-
}
|
42
|
-
],
|
43
|
-
"VideoModeration": [
|
44
|
-
{
|
45
|
-
"document": "",
|
46
|
-
"input": "POST / HTTP/1.1\nHost: ticm.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: VideoModeration\n<公共请求参数>\n\n{\n \"VideoUrl\": \"https://test.mp4\",\n \"CBUrl\": \"http://callback.test.com\",\n \"DeveloperId\": \"123456\",\n \"Extra\": \"0001\"\n}",
|
47
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"seqqq948487111111\",\n \"VodTaskId\": \"1254418846-procedurev2-aefb7f39e6d3da0e66596b93e7e9e008t0\"\n }\n}",
|
48
|
-
"title": "提交视频审核任务"
|
49
|
-
}
|
50
|
-
]
|
51
|
-
},
|
52
|
-
"version": "1.0"
|
53
|
-
}
|
tccli/services/tics/__init__.py
DELETED
@@ -1,366 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
import os
|
3
|
-
import sys
|
4
|
-
import six
|
5
|
-
import json
|
6
|
-
import tccli.options_define as OptionsDefine
|
7
|
-
import tccli.format_output as FormatOutput
|
8
|
-
from tccli import __version__
|
9
|
-
from tccli.utils import Utils
|
10
|
-
from tccli.exceptions import ConfigurationError, ClientError, ParamError
|
11
|
-
from tencentcloud.common import credential
|
12
|
-
from tencentcloud.common.profile.http_profile import HttpProfile
|
13
|
-
from tencentcloud.common.profile.client_profile import ClientProfile
|
14
|
-
from tencentcloud.tics.v20181115 import tics_client as tics_client_v20181115
|
15
|
-
from tencentcloud.tics.v20181115 import models as models_v20181115
|
16
|
-
|
17
|
-
from jmespath import search
|
18
|
-
import time
|
19
|
-
|
20
|
-
def doDescribeFileInfo(args, parsed_globals):
|
21
|
-
g_param = parse_global_arg(parsed_globals)
|
22
|
-
|
23
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
24
|
-
cred = credential.CVMRoleCredential()
|
25
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
26
|
-
cred = credential.STSAssumeRoleCredential(
|
27
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
28
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
29
|
-
)
|
30
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
31
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
32
|
-
else:
|
33
|
-
cred = credential.Credential(
|
34
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
35
|
-
)
|
36
|
-
http_profile = HttpProfile(
|
37
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
38
|
-
reqMethod="POST",
|
39
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
40
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
41
|
-
)
|
42
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
43
|
-
if g_param[OptionsDefine.Language]:
|
44
|
-
profile.language = g_param[OptionsDefine.Language]
|
45
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
46
|
-
client = mod.TicsClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
-
model = models.DescribeFileInfoRequest()
|
50
|
-
model.from_json_string(json.dumps(args))
|
51
|
-
start_time = time.time()
|
52
|
-
while True:
|
53
|
-
rsp = client.DescribeFileInfo(model)
|
54
|
-
result = rsp.to_json_string()
|
55
|
-
try:
|
56
|
-
json_obj = json.loads(result)
|
57
|
-
except TypeError as e:
|
58
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
59
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
60
|
-
break
|
61
|
-
cur_time = time.time()
|
62
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
63
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
64
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
65
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
66
|
-
else:
|
67
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
68
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
69
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
70
|
-
|
71
|
-
|
72
|
-
def doDescribeIpInfo(args, parsed_globals):
|
73
|
-
g_param = parse_global_arg(parsed_globals)
|
74
|
-
|
75
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
76
|
-
cred = credential.CVMRoleCredential()
|
77
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
78
|
-
cred = credential.STSAssumeRoleCredential(
|
79
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
80
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
81
|
-
)
|
82
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
83
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
84
|
-
else:
|
85
|
-
cred = credential.Credential(
|
86
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
87
|
-
)
|
88
|
-
http_profile = HttpProfile(
|
89
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
90
|
-
reqMethod="POST",
|
91
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
92
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
93
|
-
)
|
94
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
95
|
-
if g_param[OptionsDefine.Language]:
|
96
|
-
profile.language = g_param[OptionsDefine.Language]
|
97
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
98
|
-
client = mod.TicsClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
-
model = models.DescribeIpInfoRequest()
|
102
|
-
model.from_json_string(json.dumps(args))
|
103
|
-
start_time = time.time()
|
104
|
-
while True:
|
105
|
-
rsp = client.DescribeIpInfo(model)
|
106
|
-
result = rsp.to_json_string()
|
107
|
-
try:
|
108
|
-
json_obj = json.loads(result)
|
109
|
-
except TypeError as e:
|
110
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
111
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
112
|
-
break
|
113
|
-
cur_time = time.time()
|
114
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
115
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
116
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
117
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
118
|
-
else:
|
119
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
120
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
121
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
|
-
|
123
|
-
|
124
|
-
def doDescribeDomainInfo(args, parsed_globals):
|
125
|
-
g_param = parse_global_arg(parsed_globals)
|
126
|
-
|
127
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
128
|
-
cred = credential.CVMRoleCredential()
|
129
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
130
|
-
cred = credential.STSAssumeRoleCredential(
|
131
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
132
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
133
|
-
)
|
134
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
135
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
136
|
-
else:
|
137
|
-
cred = credential.Credential(
|
138
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
139
|
-
)
|
140
|
-
http_profile = HttpProfile(
|
141
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
142
|
-
reqMethod="POST",
|
143
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
144
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
145
|
-
)
|
146
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
147
|
-
if g_param[OptionsDefine.Language]:
|
148
|
-
profile.language = g_param[OptionsDefine.Language]
|
149
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
150
|
-
client = mod.TicsClient(cred, g_param[OptionsDefine.Region], profile)
|
151
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
152
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
-
model = models.DescribeDomainInfoRequest()
|
154
|
-
model.from_json_string(json.dumps(args))
|
155
|
-
start_time = time.time()
|
156
|
-
while True:
|
157
|
-
rsp = client.DescribeDomainInfo(model)
|
158
|
-
result = rsp.to_json_string()
|
159
|
-
try:
|
160
|
-
json_obj = json.loads(result)
|
161
|
-
except TypeError as e:
|
162
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
163
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
164
|
-
break
|
165
|
-
cur_time = time.time()
|
166
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
167
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
168
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
169
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
170
|
-
else:
|
171
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
172
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
173
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
174
|
-
|
175
|
-
|
176
|
-
def doDescribeThreatInfo(args, parsed_globals):
|
177
|
-
g_param = parse_global_arg(parsed_globals)
|
178
|
-
|
179
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
180
|
-
cred = credential.CVMRoleCredential()
|
181
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
182
|
-
cred = credential.STSAssumeRoleCredential(
|
183
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
184
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
185
|
-
)
|
186
|
-
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
187
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
188
|
-
else:
|
189
|
-
cred = credential.Credential(
|
190
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
191
|
-
)
|
192
|
-
http_profile = HttpProfile(
|
193
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
194
|
-
reqMethod="POST",
|
195
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
196
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
197
|
-
)
|
198
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
199
|
-
if g_param[OptionsDefine.Language]:
|
200
|
-
profile.language = g_param[OptionsDefine.Language]
|
201
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
202
|
-
client = mod.TicsClient(cred, g_param[OptionsDefine.Region], profile)
|
203
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
204
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
205
|
-
model = models.DescribeThreatInfoRequest()
|
206
|
-
model.from_json_string(json.dumps(args))
|
207
|
-
start_time = time.time()
|
208
|
-
while True:
|
209
|
-
rsp = client.DescribeThreatInfo(model)
|
210
|
-
result = rsp.to_json_string()
|
211
|
-
try:
|
212
|
-
json_obj = json.loads(result)
|
213
|
-
except TypeError as e:
|
214
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
215
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
216
|
-
break
|
217
|
-
cur_time = time.time()
|
218
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
219
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
220
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
221
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
222
|
-
else:
|
223
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
224
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
225
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
226
|
-
|
227
|
-
|
228
|
-
CLIENT_MAP = {
|
229
|
-
"v20181115": tics_client_v20181115,
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
MODELS_MAP = {
|
234
|
-
"v20181115": models_v20181115,
|
235
|
-
|
236
|
-
}
|
237
|
-
|
238
|
-
ACTION_MAP = {
|
239
|
-
"DescribeFileInfo": doDescribeFileInfo,
|
240
|
-
"DescribeIpInfo": doDescribeIpInfo,
|
241
|
-
"DescribeDomainInfo": doDescribeDomainInfo,
|
242
|
-
"DescribeThreatInfo": doDescribeThreatInfo,
|
243
|
-
|
244
|
-
}
|
245
|
-
|
246
|
-
AVAILABLE_VERSION_LIST = [
|
247
|
-
"v20181115",
|
248
|
-
|
249
|
-
]
|
250
|
-
|
251
|
-
|
252
|
-
def action_caller():
|
253
|
-
return ACTION_MAP
|
254
|
-
|
255
|
-
|
256
|
-
def parse_global_arg(parsed_globals):
|
257
|
-
g_param = parsed_globals
|
258
|
-
cvm_role_flag = True
|
259
|
-
for param in parsed_globals.keys():
|
260
|
-
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
|
261
|
-
OptionsDefine.RoleSessionName]:
|
262
|
-
if parsed_globals[param] is not None:
|
263
|
-
cvm_role_flag = False
|
264
|
-
break
|
265
|
-
is_exist_profile = True
|
266
|
-
if not parsed_globals["profile"]:
|
267
|
-
is_exist_profile = False
|
268
|
-
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
269
|
-
|
270
|
-
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
271
|
-
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
272
|
-
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
273
|
-
|
274
|
-
conf = {}
|
275
|
-
cred = {}
|
276
|
-
|
277
|
-
if is_conf_exist:
|
278
|
-
conf = Utils.load_json_msg(conf_path)
|
279
|
-
if is_cred_exist:
|
280
|
-
cred = Utils.load_json_msg(cred_path)
|
281
|
-
|
282
|
-
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
283
|
-
raise ConfigurationError(
|
284
|
-
"file: %s or %s is not json format"
|
285
|
-
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
286
|
-
|
287
|
-
if OptionsDefine.Token not in cred:
|
288
|
-
cred[OptionsDefine.Token] = None
|
289
|
-
|
290
|
-
if not is_exist_profile:
|
291
|
-
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
292
|
-
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
293
|
-
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
294
|
-
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
295
|
-
cvm_role_flag = False
|
296
|
-
|
297
|
-
if os.environ.get(OptionsDefine.ENV_REGION):
|
298
|
-
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
299
|
-
|
300
|
-
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
301
|
-
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
302
|
-
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
303
|
-
cvm_role_flag = False
|
304
|
-
|
305
|
-
if cvm_role_flag:
|
306
|
-
if "type" in cred and cred["type"] == "cvm-role":
|
307
|
-
g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
|
308
|
-
|
309
|
-
for param in g_param.keys():
|
310
|
-
if g_param[param] is None:
|
311
|
-
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
312
|
-
if param in cred:
|
313
|
-
g_param[param] = cred[param]
|
314
|
-
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
315
|
-
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
316
|
-
raise ConfigurationError("%s is invalid" % param)
|
317
|
-
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
318
|
-
if param in conf[OptionsDefine.SysParam]:
|
319
|
-
g_param[param] = conf[OptionsDefine.SysParam][param]
|
320
|
-
elif param != OptionsDefine.Language:
|
321
|
-
raise ConfigurationError("%s is invalid" % param)
|
322
|
-
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
323
|
-
if param.replace('_', '-') in cred:
|
324
|
-
g_param[param] = cred[param.replace('_', '-')]
|
325
|
-
|
326
|
-
try:
|
327
|
-
if g_param[OptionsDefine.ServiceVersion]:
|
328
|
-
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
329
|
-
else:
|
330
|
-
version = conf["tics"][OptionsDefine.Version]
|
331
|
-
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
332
|
-
|
333
|
-
if g_param[OptionsDefine.Endpoint] is None:
|
334
|
-
g_param[OptionsDefine.Endpoint] = conf["tics"][OptionsDefine.Endpoint]
|
335
|
-
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
336
|
-
except Exception as err:
|
337
|
-
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
338
|
-
|
339
|
-
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
340
|
-
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
341
|
-
|
342
|
-
if g_param[OptionsDefine.Waiter]:
|
343
|
-
param = eval(g_param[OptionsDefine.Waiter])
|
344
|
-
if 'expr' not in param:
|
345
|
-
raise Exception('`expr` in `--waiter` must be defined')
|
346
|
-
if 'to' not in param:
|
347
|
-
raise Exception('`to` in `--waiter` must be defined')
|
348
|
-
if 'timeout' not in param:
|
349
|
-
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
350
|
-
param['timeout'] = conf['waiter']['timeout']
|
351
|
-
else:
|
352
|
-
param['timeout'] = 180
|
353
|
-
if 'interval' not in param:
|
354
|
-
if 'waiter' in conf and 'interval' in conf['waiter']:
|
355
|
-
param['interval'] = conf['waiter']['interval']
|
356
|
-
else:
|
357
|
-
param['interval'] = 5
|
358
|
-
param['interval'] = min(param['interval'], param['timeout'])
|
359
|
-
g_param['OptionsDefine.WaiterInfo'] = param
|
360
|
-
|
361
|
-
if six.PY2:
|
362
|
-
for key, value in g_param.items():
|
363
|
-
if isinstance(value, six.text_type):
|
364
|
-
g_param[key] = value.encode('utf-8')
|
365
|
-
return g_param
|
366
|
-
|