tccli 3.0.1311.1__py2.py3-none-any.whl → 3.0.1313.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/autoscaling/v20180419/api.json +164 -161
- tccli/services/autoscaling/v20180419/examples.json +13 -13
- tccli/services/batch/v20170312/api.json +119 -143
- tccli/services/batch/v20170312/examples.json +5 -5
- tccli/services/bh/v20230418/api.json +152 -1
- tccli/services/bi/v20220105/api.json +19 -0
- tccli/services/cbs/v20170312/api.json +19 -16
- tccli/services/cbs/v20170312/examples.json +1 -1
- tccli/services/cdb/v20170320/api.json +30 -9
- tccli/services/cdb/v20170320/examples.json +1 -1
- tccli/services/cfw/v20190904/api.json +5 -7
- tccli/services/clb/v20180317/api.json +36 -36
- tccli/services/clb/v20180317/examples.json +8 -8
- tccli/services/cynosdb/v20190107/api.json +14 -4
- tccli/services/cynosdb/v20190107/examples.json +1 -1
- tccli/services/dbbrain/dbbrain_client.py +147 -41
- tccli/services/dbbrain/v20210527/api.json +224 -0
- tccli/services/dbbrain/v20210527/examples.json +16 -0
- tccli/services/dnspod/dnspod_client.py +53 -0
- tccli/services/dnspod/v20210323/api.json +287 -0
- tccli/services/dnspod/v20210323/examples.json +8 -0
- tccli/services/domain/v20180808/api.json +21 -21
- tccli/services/domain/v20180808/examples.json +2 -2
- tccli/services/emr/v20190103/api.json +20 -0
- tccli/services/ess/v20201111/api.json +9 -0
- tccli/services/essbasic/v20210526/api.json +1 -1
- tccli/services/essbasic/v20210526/examples.json +6 -0
- tccli/services/goosefs/v20220519/api.json +5 -5
- tccli/services/ims/v20201229/api.json +93 -102
- tccli/services/lkeap/v20240522/api.json +1 -1
- tccli/services/mps/v20190612/api.json +96 -1
- tccli/services/postgres/postgres_client.py +0 -53
- tccli/services/postgres/v20170312/api.json +12 -55
- tccli/services/postgres/v20170312/examples.json +0 -14
- tccli/services/tbaas/tbaas_client.py +0 -53
- tccli/services/tbaas/v20180416/api.json +0 -133
- tccli/services/tbaas/v20180416/examples.json +0 -8
- tccli/services/tcb/v20180608/api.json +5 -5
- tccli/services/teo/teo_client.py +53 -0
- tccli/services/teo/v20220901/api.json +464 -100
- tccli/services/teo/v20220901/examples.json +8 -0
- tccli/services/thpc/thpc_client.py +53 -0
- tccli/services/thpc/v20211109/api.json +2 -2
- tccli/services/thpc/v20220401/api.json +3 -3
- tccli/services/thpc/v20230321/api.json +43 -0
- tccli/services/thpc/v20230321/examples.json +8 -0
- tccli/services/tke/v20180525/api.json +106 -82
- tccli/services/tms/v20201229/api.json +47 -59
- tccli/services/tmt/tmt_client.py +61 -8
- tccli/services/tmt/v20180321/api.json +234 -0
- tccli/services/tmt/v20180321/examples.json +8 -0
- tccli/services/trtc/v20190722/api.json +2 -2
- tccli/services/vpc/v20170312/api.json +61 -61
- tccli/services/vpc/v20170312/examples.json +10 -10
- tccli/services/waf/v20180125/api.json +11 -0
- tccli/services/wedata/v20210820/api.json +907 -0
- tccli/services/wedata/v20210820/examples.json +40 -0
- tccli/services/wedata/wedata_client.py +277 -12
- {tccli-3.0.1311.1.dist-info → tccli-3.0.1313.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1311.1.dist-info → tccli-3.0.1313.1.dist-info}/RECORD +64 -64
- {tccli-3.0.1311.1.dist-info → tccli-3.0.1313.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1311.1.dist-info → tccli-3.0.1313.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1311.1.dist-info → tccli-3.0.1313.1.dist-info}/license_files/LICENSE +0 -0
@@ -21,7 +21,7 @@
|
|
21
21
|
{
|
22
22
|
"disabled": false,
|
23
23
|
"document": "该字段用于返回检测结果所对应的全部恶意标签。<br>返回值:**Normal**:正常,**Porn**:色情,**Abuse**:谩骂,**Ad**:广告;以及其他令人反感、不安全或不适宜的内容类型。",
|
24
|
-
"example": "
|
24
|
+
"example": "Ad",
|
25
25
|
"member": "string",
|
26
26
|
"name": "Label",
|
27
27
|
"output_required": true,
|
@@ -31,7 +31,7 @@
|
|
31
31
|
{
|
32
32
|
"disabled": false,
|
33
33
|
"document": "该字段用于返回对应当前标签的后续操作建议。当您获取到判定结果后,返回值表示系统推荐的后续操作;建议您按照业务所需,对不同违规类型与建议值进行处理。<br>返回值:**Block**:建议屏蔽,**Review** :建议人工复审,**Pass**:建议通过\n注意:此字段可能返回 null,表示取不到有效值。",
|
34
|
-
"example": "
|
34
|
+
"example": "Review",
|
35
35
|
"member": "string",
|
36
36
|
"name": "Suggestion",
|
37
37
|
"output_required": true,
|
@@ -41,7 +41,7 @@
|
|
41
41
|
{
|
42
42
|
"disabled": false,
|
43
43
|
"document": "该字段用于返回检测文本命中的关键词信息,用于标注文本违规的具体原因(如:*加我微信*)。该参数可能会有多个返回值,代表命中的多个关键词;如返回值为空且Score不为空,则代表识别结果所对应的恶意标签(Label)是来自于语义模型判断的返回值。\n注意:此字段可能返回 null,表示取不到有效值。",
|
44
|
-
"example": "
|
44
|
+
"example": "[\"添加微信\",\"加好友\"]",
|
45
45
|
"member": "string",
|
46
46
|
"name": "Keywords",
|
47
47
|
"output_required": true,
|
@@ -51,7 +51,7 @@
|
|
51
51
|
{
|
52
52
|
"disabled": false,
|
53
53
|
"document": "该字段用于返回当前标签(Label)下的置信度,取值范围:0(**置信度最低**)-100(**置信度最高** ),越高代表文本越有可能属于当前返回的标签;如:*色情 99*,则表明该文本非常有可能属于色情内容;*色情 0*,则表明该文本不属于色情内容。\n注意:此字段可能返回 null,表示取不到有效值。",
|
54
|
-
"example": "
|
54
|
+
"example": "100",
|
55
55
|
"member": "int64",
|
56
56
|
"name": "Score",
|
57
57
|
"output_required": true,
|
@@ -61,7 +61,7 @@
|
|
61
61
|
{
|
62
62
|
"disabled": false,
|
63
63
|
"document": "该字段用于返回自定义关键词对应的词库类型,取值为**1**(黑白库)和**2**(自定义关键词库),若未配置自定义关键词库,则默认值为1(黑白库匹配)。\n注意:此字段可能返回 null,表示取不到有效值。",
|
64
|
-
"example": "
|
64
|
+
"example": "1",
|
65
65
|
"member": "int64",
|
66
66
|
"name": "LibType",
|
67
67
|
"output_required": true,
|
@@ -71,7 +71,7 @@
|
|
71
71
|
{
|
72
72
|
"disabled": false,
|
73
73
|
"document": "该字段用于返回自定义库的ID,以方便自定义库管理和配置。\n注意:此字段可能返回 null,表示取不到有效值。",
|
74
|
-
"example": "
|
74
|
+
"example": "test_1",
|
75
75
|
"member": "string",
|
76
76
|
"name": "LibId",
|
77
77
|
"output_required": true,
|
@@ -81,7 +81,7 @@
|
|
81
81
|
{
|
82
82
|
"disabled": false,
|
83
83
|
"document": "该字段用于返回自定义库的名称,以方便自定义库管理和配置。\n注意:此字段可能返回 null,表示取不到有效值。",
|
84
|
-
"example": "
|
84
|
+
"example": "测试词库",
|
85
85
|
"member": "string",
|
86
86
|
"name": "LibName",
|
87
87
|
"output_required": true,
|
@@ -91,7 +91,7 @@
|
|
91
91
|
{
|
92
92
|
"disabled": false,
|
93
93
|
"document": "该字段用于返回当前标签(Label)下的二级标签。\n注意:此字段可能返回 null,表示取不到有效值。",
|
94
|
-
"example": "
|
94
|
+
"example": "SocialMediaPlatform",
|
95
95
|
"member": "string",
|
96
96
|
"name": "SubLabel",
|
97
97
|
"output_required": true,
|
@@ -101,7 +101,7 @@
|
|
101
101
|
{
|
102
102
|
"disabled": false,
|
103
103
|
"document": "该字段用于返回当前一级标签(Label)下的关键词、子标签及分数。\n注意:此字段可能返回 null,表示取不到有效值。",
|
104
|
-
"example": "
|
104
|
+
"example": "无",
|
105
105
|
"member": "Tag",
|
106
106
|
"name": "Tags",
|
107
107
|
"output_required": true,
|
@@ -203,30 +203,30 @@
|
|
203
203
|
{
|
204
204
|
"disabled": false,
|
205
205
|
"document": "标识模型命中还是关键词命中\n注意:此字段可能返回 null,表示取不到有效值。",
|
206
|
-
"example": "
|
206
|
+
"example": "Keyword",
|
207
207
|
"member": "string",
|
208
208
|
"name": "Type",
|
209
|
-
"
|
209
|
+
"output_required": true,
|
210
210
|
"type": "string",
|
211
211
|
"value_allowed_null": true
|
212
212
|
},
|
213
213
|
{
|
214
214
|
"disabled": false,
|
215
215
|
"document": "命中关键词\n注意:此字段可能返回 null,表示取不到有效值。",
|
216
|
-
"example": "
|
216
|
+
"example": "添加好友",
|
217
217
|
"member": "string",
|
218
218
|
"name": "Keyword",
|
219
|
-
"
|
219
|
+
"output_required": true,
|
220
220
|
"type": "string",
|
221
221
|
"value_allowed_null": true
|
222
222
|
},
|
223
223
|
{
|
224
224
|
"disabled": false,
|
225
225
|
"document": "自定义词库名称\n注意:此字段可能返回 null,表示取不到有效值。",
|
226
|
-
"example": "测试词库
|
226
|
+
"example": "测试词库",
|
227
227
|
"member": "string",
|
228
228
|
"name": "LibName",
|
229
|
-
"
|
229
|
+
"output_required": true,
|
230
230
|
"type": "string",
|
231
231
|
"value_allowed_null": true
|
232
232
|
},
|
@@ -236,7 +236,7 @@
|
|
236
236
|
"example": "无",
|
237
237
|
"member": "Positions",
|
238
238
|
"name": "Positions",
|
239
|
-
"
|
239
|
+
"output_required": true,
|
240
240
|
"type": "list",
|
241
241
|
"value_allowed_null": true
|
242
242
|
}
|
@@ -275,20 +275,20 @@
|
|
275
275
|
{
|
276
276
|
"disabled": false,
|
277
277
|
"document": "该字段用于返回账号信息检测对应的风险类别,取值为:**RiskAccount**(账号存在风险)、**RiskIP**(IP地址存在风险)、**RiskIMEI**(移动设备识别码存在风险)。",
|
278
|
-
"example": "
|
278
|
+
"example": "RiskAccount",
|
279
279
|
"member": "string",
|
280
280
|
"name": "Label",
|
281
|
-
"
|
281
|
+
"output_required": true,
|
282
282
|
"type": "string",
|
283
283
|
"value_allowed_null": false
|
284
284
|
},
|
285
285
|
{
|
286
286
|
"disabled": false,
|
287
287
|
"document": "该字段用于返回账号信息检测对应的风险等级,取值为:**1**(疑似存在风险)和**2**(存在恶意风险)。",
|
288
|
-
"example": "
|
288
|
+
"example": "1",
|
289
289
|
"member": "int64",
|
290
290
|
"name": "Level",
|
291
|
-
"
|
291
|
+
"output_required": true,
|
292
292
|
"type": "int",
|
293
293
|
"value_allowed_null": false
|
294
294
|
}
|
@@ -341,7 +341,7 @@
|
|
341
341
|
{
|
342
342
|
"disabled": false,
|
343
343
|
"document": "异常信息\n注意:此字段可能返回 null,表示取不到有效值。",
|
344
|
-
"example": "
|
344
|
+
"example": "InternalError",
|
345
345
|
"member": "string",
|
346
346
|
"name": "Message",
|
347
347
|
"output_required": false,
|
@@ -383,7 +383,7 @@
|
|
383
383
|
{
|
384
384
|
"disabled": false,
|
385
385
|
"document": "该字段用于返回命中的关键词\n注意:此字段可能返回 null,表示取不到有效值。",
|
386
|
-
"example": "
|
386
|
+
"example": "添加微信",
|
387
387
|
"member": "string",
|
388
388
|
"name": "Keyword",
|
389
389
|
"output_required": false,
|
@@ -393,7 +393,7 @@
|
|
393
393
|
{
|
394
394
|
"disabled": false,
|
395
395
|
"document": "该字段用于返回子标签\n注意:此字段可能返回 null,表示取不到有效值。",
|
396
|
-
"example": "
|
396
|
+
"example": "SocialMediaPlatform",
|
397
397
|
"member": "string",
|
398
398
|
"name": "SubLabel",
|
399
399
|
"output_required": false,
|
@@ -611,122 +611,110 @@
|
|
611
611
|
{
|
612
612
|
"disabled": false,
|
613
613
|
"document": "该字段表示业务用户ID,填写后,系统可根据账号过往违规历史优化审核结果判定,有利于存在可疑违规风险时的辅助判断。<br>\n备注:该字段可传入微信openid、QQopenid、字符串等账号信息,与账号类别参数(AccountType)配合使用可确定唯一账号。",
|
614
|
-
"example": "
|
614
|
+
"example": "user1",
|
615
615
|
"member": "string",
|
616
616
|
"name": "UserId",
|
617
617
|
"required": false,
|
618
|
-
"type": "string"
|
619
|
-
"value_allowed_null": false
|
618
|
+
"type": "string"
|
620
619
|
},
|
621
620
|
{
|
622
621
|
"disabled": false,
|
623
622
|
"document": "该字段表示业务用户对应的账号昵称信息。",
|
624
|
-
"example": "
|
623
|
+
"example": "name",
|
625
624
|
"member": "string",
|
626
625
|
"name": "Nickname",
|
627
626
|
"required": false,
|
628
|
-
"type": "string"
|
629
|
-
"value_allowed_null": false
|
627
|
+
"type": "string"
|
630
628
|
},
|
631
629
|
{
|
632
630
|
"disabled": false,
|
633
631
|
"document": "该字段表示业务用户ID对应的账号类型,取值:**1**-微信uin,**2**-QQ号,**3**-微信群uin,**4**-qq群号,**5**-微信openid,**6**-QQopenid,**7**-其它string。<br>\n该字段与账号ID参数(UserId)配合使用可确定唯一账号。",
|
634
|
-
"example": "
|
632
|
+
"example": "172300",
|
635
633
|
"member": "int64",
|
636
634
|
"name": "AccountType",
|
637
635
|
"required": false,
|
638
|
-
"type": "int"
|
639
|
-
"value_allowed_null": false
|
636
|
+
"type": "int"
|
640
637
|
},
|
641
638
|
{
|
642
639
|
"disabled": false,
|
643
640
|
"document": "该字段表示业务用户对应账号的性别信息。<br>\n取值:**0**(默认值,代表性别未知)、**1**(男性)、**2**(女性)。",
|
644
|
-
"example": "
|
641
|
+
"example": "1",
|
645
642
|
"member": "int64",
|
646
643
|
"name": "Gender",
|
647
644
|
"required": false,
|
648
|
-
"type": "int"
|
649
|
-
"value_allowed_null": false
|
645
|
+
"type": "int"
|
650
646
|
},
|
651
647
|
{
|
652
648
|
"disabled": false,
|
653
649
|
"document": "该字段表示业务用户对应账号的年龄信息。<br>\n取值:**0**(默认值,代表年龄未知)-(**自定义年龄上限**)之间的整数。",
|
654
|
-
"example": "
|
650
|
+
"example": "16",
|
655
651
|
"member": "int64",
|
656
652
|
"name": "Age",
|
657
653
|
"required": false,
|
658
|
-
"type": "int"
|
659
|
-
"value_allowed_null": false
|
654
|
+
"type": "int"
|
660
655
|
},
|
661
656
|
{
|
662
657
|
"disabled": false,
|
663
658
|
"document": "该字段表示业务用户对应账号的等级信息。<br>\n取值:**0**(默认值,代表等级未知)、**1**(等级较低)、**2**(等级中等)、**3**(等级较高),目前**暂不支持自定义等级**。",
|
664
|
-
"example": "
|
659
|
+
"example": "1",
|
665
660
|
"member": "int64",
|
666
661
|
"name": "Level",
|
667
662
|
"required": false,
|
668
|
-
"type": "int"
|
669
|
-
"value_allowed_null": false
|
663
|
+
"type": "int"
|
670
664
|
},
|
671
665
|
{
|
672
666
|
"disabled": false,
|
673
667
|
"document": "该字段表示业务用户对应账号的手机号信息,支持全球各地区手机号的记录。<br>\n备注:请保持手机号格式的统一,如区号格式(086/+86)等。",
|
674
|
-
"example": "
|
668
|
+
"example": "176****2131",
|
675
669
|
"member": "string",
|
676
670
|
"name": "Phone",
|
677
671
|
"required": false,
|
678
|
-
"type": "string"
|
679
|
-
"value_allowed_null": false
|
672
|
+
"type": "string"
|
680
673
|
},
|
681
674
|
{
|
682
675
|
"disabled": false,
|
683
676
|
"document": "该字段表示业务用户头像图片的访问链接(URL),支持PNG、JPG、JPEG、BMP、GIF、WEBP格式。\n备注:头像图片大小不超过5MB,建议分辨率不低于256x256;图片下载时间限制为3秒,超过则会返回下载超时。",
|
684
|
-
"example": "
|
677
|
+
"example": "https://cmstest-123.cos.ap-guangzhou.myqcloud.com/image.jpg",
|
685
678
|
"member": "string",
|
686
679
|
"name": "HeadUrl",
|
687
680
|
"required": false,
|
688
|
-
"type": "string"
|
689
|
-
"value_allowed_null": false
|
681
|
+
"type": "string"
|
690
682
|
},
|
691
683
|
{
|
692
684
|
"disabled": false,
|
693
685
|
"document": "该字段表示业务用户的简介信息,支持汉字、英文及特殊符号,长度不超过5000个汉字字符。",
|
694
|
-
"example": "
|
686
|
+
"example": "Desc01",
|
695
687
|
"member": "string",
|
696
688
|
"name": "Desc",
|
697
689
|
"required": false,
|
698
|
-
"type": "string"
|
699
|
-
"value_allowed_null": false
|
690
|
+
"type": "string"
|
700
691
|
},
|
701
692
|
{
|
702
693
|
"disabled": false,
|
703
694
|
"document": "该字段表示业务群聊场景时的房间ID。",
|
704
|
-
"example": "
|
695
|
+
"example": "roomid_1",
|
705
696
|
"member": "string",
|
706
697
|
"name": "RoomId",
|
707
698
|
"required": false,
|
708
|
-
"type": "string"
|
709
|
-
"value_allowed_null": false
|
699
|
+
"type": "string"
|
710
700
|
},
|
711
701
|
{
|
712
702
|
"disabled": false,
|
713
703
|
"document": "该字段表示消息接受者ID",
|
714
|
-
"example": "
|
704
|
+
"example": "user_1",
|
715
705
|
"member": "string",
|
716
706
|
"name": "ReceiverId",
|
717
707
|
"required": false,
|
718
|
-
"type": "string"
|
719
|
-
"value_allowed_null": false
|
708
|
+
"type": "string"
|
720
709
|
},
|
721
710
|
{
|
722
711
|
"disabled": false,
|
723
712
|
"document": "消息生成时间,精确到毫秒",
|
724
|
-
"example": "
|
713
|
+
"example": "2025-05-15 14:41:27",
|
725
714
|
"member": "int64",
|
726
715
|
"name": "SendTime",
|
727
716
|
"required": false,
|
728
|
-
"type": "int"
|
729
|
-
"value_allowed_null": false
|
717
|
+
"type": "int"
|
730
718
|
}
|
731
719
|
],
|
732
720
|
"usage": "in"
|
tccli/services/tmt/tmt_client.py
CHANGED
@@ -121,7 +121,7 @@ def doTextTranslateBatch(args, parsed_globals):
|
|
121
121
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
122
|
|
123
123
|
|
124
|
-
def
|
124
|
+
def doImageTranslateLLM(args, parsed_globals):
|
125
125
|
g_param = parse_global_arg(parsed_globals)
|
126
126
|
|
127
127
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -150,11 +150,11 @@ def doImageTranslate(args, parsed_globals):
|
|
150
150
|
client = mod.TmtClient(cred, g_param[OptionsDefine.Region], profile)
|
151
151
|
client._sdkVersion += ("_CLI_" + __version__)
|
152
152
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
-
model = models.
|
153
|
+
model = models.ImageTranslateLLMRequest()
|
154
154
|
model.from_json_string(json.dumps(args))
|
155
155
|
start_time = time.time()
|
156
156
|
while True:
|
157
|
-
rsp = client.
|
157
|
+
rsp = client.ImageTranslateLLM(model)
|
158
158
|
result = rsp.to_json_string()
|
159
159
|
try:
|
160
160
|
json_obj = json.loads(result)
|
@@ -225,6 +225,58 @@ def doGetFileTranslate(args, parsed_globals):
|
|
225
225
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
226
226
|
|
227
227
|
|
228
|
+
def doFileTranslate(args, parsed_globals):
|
229
|
+
g_param = parse_global_arg(parsed_globals)
|
230
|
+
|
231
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
232
|
+
cred = credential.CVMRoleCredential()
|
233
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
234
|
+
cred = credential.STSAssumeRoleCredential(
|
235
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
236
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
237
|
+
)
|
238
|
+
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):
|
239
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
240
|
+
else:
|
241
|
+
cred = credential.Credential(
|
242
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
243
|
+
)
|
244
|
+
http_profile = HttpProfile(
|
245
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
246
|
+
reqMethod="POST",
|
247
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
248
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
249
|
+
)
|
250
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
251
|
+
if g_param[OptionsDefine.Language]:
|
252
|
+
profile.language = g_param[OptionsDefine.Language]
|
253
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
254
|
+
client = mod.TmtClient(cred, g_param[OptionsDefine.Region], profile)
|
255
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
256
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
257
|
+
model = models.FileTranslateRequest()
|
258
|
+
model.from_json_string(json.dumps(args))
|
259
|
+
start_time = time.time()
|
260
|
+
while True:
|
261
|
+
rsp = client.FileTranslate(model)
|
262
|
+
result = rsp.to_json_string()
|
263
|
+
try:
|
264
|
+
json_obj = json.loads(result)
|
265
|
+
except TypeError as e:
|
266
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
267
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
268
|
+
break
|
269
|
+
cur_time = time.time()
|
270
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
271
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
272
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
273
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
274
|
+
else:
|
275
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
276
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
277
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
278
|
+
|
279
|
+
|
228
280
|
def doTextTranslate(args, parsed_globals):
|
229
281
|
g_param = parse_global_arg(parsed_globals)
|
230
282
|
|
@@ -277,7 +329,7 @@ def doTextTranslate(args, parsed_globals):
|
|
277
329
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
278
330
|
|
279
331
|
|
280
|
-
def
|
332
|
+
def doImageTranslate(args, parsed_globals):
|
281
333
|
g_param = parse_global_arg(parsed_globals)
|
282
334
|
|
283
335
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -306,11 +358,11 @@ def doFileTranslate(args, parsed_globals):
|
|
306
358
|
client = mod.TmtClient(cred, g_param[OptionsDefine.Region], profile)
|
307
359
|
client._sdkVersion += ("_CLI_" + __version__)
|
308
360
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
309
|
-
model = models.
|
361
|
+
model = models.ImageTranslateRequest()
|
310
362
|
model.from_json_string(json.dumps(args))
|
311
363
|
start_time = time.time()
|
312
364
|
while True:
|
313
|
-
rsp = client.
|
365
|
+
rsp = client.ImageTranslate(model)
|
314
366
|
result = rsp.to_json_string()
|
315
367
|
try:
|
316
368
|
json_obj = json.loads(result)
|
@@ -394,10 +446,11 @@ MODELS_MAP = {
|
|
394
446
|
ACTION_MAP = {
|
395
447
|
"LanguageDetect": doLanguageDetect,
|
396
448
|
"TextTranslateBatch": doTextTranslateBatch,
|
397
|
-
"
|
449
|
+
"ImageTranslateLLM": doImageTranslateLLM,
|
398
450
|
"GetFileTranslate": doGetFileTranslate,
|
399
|
-
"TextTranslate": doTextTranslate,
|
400
451
|
"FileTranslate": doFileTranslate,
|
452
|
+
"TextTranslate": doTextTranslate,
|
453
|
+
"ImageTranslate": doImageTranslate,
|
401
454
|
"SpeechTranslate": doSpeechTranslate,
|
402
455
|
|
403
456
|
}
|