tccli 3.0.1258.1__py2.py3-none-any.whl → 3.0.1260.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/bi/v20220105/api.json +15 -15
- tccli/services/bi/v20220105/examples.json +2 -2
- tccli/services/ccc/ccc_client.py +61 -8
- tccli/services/ccc/v20200210/api.json +233 -1
- tccli/services/ccc/v20200210/examples.json +8 -0
- tccli/services/cfw/cfw_client.py +0 -53
- tccli/services/cfw/v20190904/api.json +0 -43
- tccli/services/cfw/v20190904/examples.json +0 -8
- tccli/services/dnspod/v20210323/examples.json +1 -1
- tccli/services/faceid/v20180301/api.json +1 -1
- tccli/services/lighthouse/v20200324/api.json +3 -3
- tccli/services/ocr/ocr_client.py +167 -61
- tccli/services/ocr/v20181119/api.json +409 -120
- tccli/services/ocr/v20181119/examples.json +21 -5
- tccli/services/rum/v20210622/api.json +56 -56
- tccli/services/rum/v20210622/examples.json +20 -20
- tccli/services/ses/v20201002/api.json +189 -115
- tccli/services/ses/v20201002/examples.json +8 -8
- tccli/services/teo/v20220901/api.json +6 -6
- tccli/services/trtc/v20190722/api.json +4 -4
- {tccli-3.0.1258.1.dist-info → tccli-3.0.1260.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1258.1.dist-info → tccli-3.0.1260.1.dist-info}/RECORD +26 -26
- {tccli-3.0.1258.1.dist-info → tccli-3.0.1260.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1258.1.dist-info → tccli-3.0.1260.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1258.1.dist-info → tccli-3.0.1260.1.dist-info}/license_files/LICENSE +0 -0
@@ -525,13 +525,6 @@
|
|
525
525
|
"output": "ModifyAllRuleStatusResponse",
|
526
526
|
"status": "online"
|
527
527
|
},
|
528
|
-
"ModifyAllVPCSwitchStatus": {
|
529
|
-
"document": "该接口已不再使用\n\nVPC防火墙一键开关",
|
530
|
-
"input": "ModifyAllVPCSwitchStatusRequest",
|
531
|
-
"name": "VPC防火墙一键开关",
|
532
|
-
"output": "ModifyAllVPCSwitchStatusResponse",
|
533
|
-
"status": "deprecated"
|
534
|
-
},
|
535
528
|
"ModifyAssetScan": {
|
536
529
|
"document": "资产扫描",
|
537
530
|
"input": "ModifyAssetScanRequest",
|
@@ -9971,42 +9964,6 @@
|
|
9971
9964
|
],
|
9972
9965
|
"type": "object"
|
9973
9966
|
},
|
9974
|
-
"ModifyAllVPCSwitchStatusRequest": {
|
9975
|
-
"document": "ModifyAllVPCSwitchStatus请求参数结构体",
|
9976
|
-
"members": [
|
9977
|
-
{
|
9978
|
-
"disabled": false,
|
9979
|
-
"document": "状态,0:关闭,1:开启",
|
9980
|
-
"example": "0",
|
9981
|
-
"member": "int64",
|
9982
|
-
"name": "Status",
|
9983
|
-
"required": true,
|
9984
|
-
"type": "int"
|
9985
|
-
},
|
9986
|
-
{
|
9987
|
-
"disabled": false,
|
9988
|
-
"document": "选中的防火墙开关Id",
|
9989
|
-
"example": "[]",
|
9990
|
-
"member": "string",
|
9991
|
-
"name": "FireWallVpcIds",
|
9992
|
-
"required": false,
|
9993
|
-
"type": "list"
|
9994
|
-
}
|
9995
|
-
],
|
9996
|
-
"type": "object"
|
9997
|
-
},
|
9998
|
-
"ModifyAllVPCSwitchStatusResponse": {
|
9999
|
-
"document": "ModifyAllVPCSwitchStatus返回参数结构体",
|
10000
|
-
"members": [
|
10001
|
-
{
|
10002
|
-
"document": "唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。",
|
10003
|
-
"member": "string",
|
10004
|
-
"name": "RequestId",
|
10005
|
-
"type": "string"
|
10006
|
-
}
|
10007
|
-
],
|
10008
|
-
"type": "object"
|
10009
|
-
},
|
10010
9967
|
"ModifyAssetScanRequest": {
|
10011
9968
|
"document": "ModifyAssetScan请求参数结构体",
|
10012
9969
|
"members": [
|
@@ -636,14 +636,6 @@
|
|
636
636
|
"title": "启用停用全部规则"
|
637
637
|
}
|
638
638
|
],
|
639
|
-
"ModifyAllVPCSwitchStatus": [
|
640
|
-
{
|
641
|
-
"document": "",
|
642
|
-
"input": "POST / HTTP/1.1\nHost: cfw.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyAllVPCSwitchStatus\n<公共请求参数>\n\n{\n \"FireWallVpcIds\": [],\n \"Status\": 0\n}",
|
643
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"3c140219-cfe9-470e-b241-907877d6fb03\"\n }\n}",
|
644
|
-
"title": "一键开启和关闭"
|
645
|
-
}
|
646
|
-
],
|
647
639
|
"ModifyAssetScan": [
|
648
640
|
{
|
649
641
|
"document": "",
|
@@ -589,7 +589,7 @@
|
|
589
589
|
"document": " ",
|
590
590
|
"input": "POST / HTTP/1.1\nHost: dnspod.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyRecord\n<公共请求参数>\n\n{\n \"Domain\": \"dnspod.site\",\n \"DomainId\": 62,\n \"SubDomain\": \"bbbb\",\n \"RecordType\": \"A\",\n \"RecordLine\": \"默认\",\n \"RecordLineId\": \"0\",\n \"Value\": \"129.23.32.32\",\n \"MX\": 0,\n \"TTL\": 600,\n \"Weight\": 10,\n \"Status\": \"DISABLE\",\n \"RecordId\": 162\n}",
|
591
591
|
"output": "{\n \"Response\": {\n \"RequestId\": \"ab4f1426-ea15-42ea-8183-dc1b44151166\",\n \"RecordId\": 162\n }\n}",
|
592
|
-
"title": "
|
592
|
+
"title": "修改记录"
|
593
593
|
}
|
594
594
|
],
|
595
595
|
"ModifyRecordBatch": [
|
@@ -2395,7 +2395,7 @@
|
|
2395
2395
|
"members": [
|
2396
2396
|
{
|
2397
2397
|
"disabled": false,
|
2398
|
-
"document": "E证通流程的唯一标识,调用GetEidToken接口时生成。",
|
2398
|
+
"document": "E证通流程的唯一标识,调用[GetEidToken](https://cloud.tencent.com/document/product/1007/54089)接口时生成。",
|
2399
2399
|
"example": "CE661F1A-0F1E-45BD-BE133-34C05CEA76812",
|
2400
2400
|
"member": "string",
|
2401
2401
|
"name": "EidToken",
|
@@ -407,7 +407,7 @@
|
|
407
407
|
"status": "online"
|
408
408
|
},
|
409
409
|
"DescribeResetInstanceBlueprints": {
|
410
|
-
"document": "本接口(DescribeResetInstanceBlueprints
|
410
|
+
"document": "本接口(DescribeResetInstanceBlueprints)查询重置实例的镜像信息。对于游戏专区实例,该接口只会返回当前镜像,且不支持 Filters 参数。",
|
411
411
|
"input": "DescribeResetInstanceBlueprintsRequest",
|
412
412
|
"name": "查询重置实例的镜像信息",
|
413
413
|
"output": "DescribeResetInstanceBlueprintsResponse",
|
@@ -680,7 +680,7 @@
|
|
680
680
|
"status": "online"
|
681
681
|
},
|
682
682
|
"ResetInstance": {
|
683
|
-
"document": "本接口(ResetInstance)用于重装指定实例上的镜像。\n\n* 如果指定了 BlueprintId 参数,则使用指定的镜像重装;否则按照当前实例使用的镜像进行重装。\n* 系统盘将会被格式化,并重置;请确保系统盘中无重要文件。\n* 目前不支持实例使用该接口实现 LINUX_UNIX 和 WINDOWS 操作系统切换。\n* 本接口为异步接口,请求发送成功后会返回一个 RequestId,此时操作并未立即完成。实例操作结果可以通过调用 <a href=\"https://cloud.tencent.com/document/product/1207/47573\" target=\"_blank\">DescribeInstances</a> 接口查询,如果实例的最新操作状态(LatestOperationState)为“SUCCESS
|
683
|
+
"document": "本接口(ResetInstance)用于重装指定实例上的镜像。\n\n* 如果指定了 BlueprintId 参数,则使用指定的镜像重装;否则按照当前实例使用的镜像进行重装。\n* 系统盘将会被格式化,并重置;请确保系统盘中无重要文件。\n* 目前不支持实例使用该接口实现 LINUX_UNIX 和 WINDOWS 操作系统切换。\n* 本接口为异步接口,请求发送成功后会返回一个 RequestId,此时操作并未立即完成。实例操作结果可以通过调用 <a href=\"https://cloud.tencent.com/document/product/1207/47573\" target=\"_blank\">DescribeInstances</a> 接口查询,如果实例的最新操作状态(LatestOperationState)为“SUCCESS”,则代表操作成功。\n* 对于游戏专区实例,仅支持重装当前镜像。",
|
684
684
|
"input": "ResetInstanceRequest",
|
685
685
|
"name": "重装系统",
|
686
686
|
"output": "ResetInstanceResponse",
|
@@ -2848,7 +2848,7 @@
|
|
2848
2848
|
"members": [
|
2849
2849
|
{
|
2850
2850
|
"disabled": false,
|
2851
|
-
"document": "套餐 ID
|
2851
|
+
"document": "套餐 ID 列表。每次请求批量套餐的上限为 100。可通过[DescribeBundles](https://cloud.tencent.com/document/product/1207/47575)接口返回值中的BundleId获取。",
|
2852
2852
|
"example": "[\"bundle_ntp_small1_500”]",
|
2853
2853
|
"member": "string",
|
2854
2854
|
"name": "BundleIds",
|
tccli/services/ocr/ocr_client.py
CHANGED
@@ -17,6 +17,58 @@ from tencentcloud.ocr.v20181119 import models as models_v20181119
|
|
17
17
|
from jmespath import search
|
18
18
|
import time
|
19
19
|
|
20
|
+
def doQuestionOCR(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.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.QuestionOCRRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.QuestionOCR(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
|
+
|
20
72
|
def doTextDetect(args, parsed_globals):
|
21
73
|
g_param = parse_global_arg(parsed_globals)
|
22
74
|
|
@@ -537,7 +589,7 @@ def doInvoiceGeneralOCR(args, parsed_globals):
|
|
537
589
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
538
590
|
|
539
591
|
|
540
|
-
def
|
592
|
+
def doRideHailingTransportLicenseOCR(args, parsed_globals):
|
541
593
|
g_param = parse_global_arg(parsed_globals)
|
542
594
|
|
543
595
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -566,11 +618,11 @@ def doReconstructDocument(args, parsed_globals):
|
|
566
618
|
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
567
619
|
client._sdkVersion += ("_CLI_" + __version__)
|
568
620
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
569
|
-
model = models.
|
621
|
+
model = models.RideHailingTransportLicenseOCRRequest()
|
570
622
|
model.from_json_string(json.dumps(args))
|
571
623
|
start_time = time.time()
|
572
624
|
while True:
|
573
|
-
rsp = client.
|
625
|
+
rsp = client.RideHailingTransportLicenseOCR(model)
|
574
626
|
result = rsp.to_json_string()
|
575
627
|
try:
|
576
628
|
json_obj = json.loads(result)
|
@@ -1577,58 +1629,6 @@ def doGetTaskState(args, parsed_globals):
|
|
1577
1629
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1578
1630
|
|
1579
1631
|
|
1580
|
-
def doRecognizeGeneralCardWarn(args, parsed_globals):
|
1581
|
-
g_param = parse_global_arg(parsed_globals)
|
1582
|
-
|
1583
|
-
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
1584
|
-
cred = credential.CVMRoleCredential()
|
1585
|
-
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
1586
|
-
cred = credential.STSAssumeRoleCredential(
|
1587
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
1588
|
-
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
1589
|
-
)
|
1590
|
-
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):
|
1591
|
-
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
1592
|
-
else:
|
1593
|
-
cred = credential.Credential(
|
1594
|
-
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
1595
|
-
)
|
1596
|
-
http_profile = HttpProfile(
|
1597
|
-
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
1598
|
-
reqMethod="POST",
|
1599
|
-
endpoint=g_param[OptionsDefine.Endpoint],
|
1600
|
-
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
1601
|
-
)
|
1602
|
-
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
1603
|
-
if g_param[OptionsDefine.Language]:
|
1604
|
-
profile.language = g_param[OptionsDefine.Language]
|
1605
|
-
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
1606
|
-
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
1607
|
-
client._sdkVersion += ("_CLI_" + __version__)
|
1608
|
-
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
1609
|
-
model = models.RecognizeGeneralCardWarnRequest()
|
1610
|
-
model.from_json_string(json.dumps(args))
|
1611
|
-
start_time = time.time()
|
1612
|
-
while True:
|
1613
|
-
rsp = client.RecognizeGeneralCardWarn(model)
|
1614
|
-
result = rsp.to_json_string()
|
1615
|
-
try:
|
1616
|
-
json_obj = json.loads(result)
|
1617
|
-
except TypeError as e:
|
1618
|
-
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
1619
|
-
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
1620
|
-
break
|
1621
|
-
cur_time = time.time()
|
1622
|
-
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
1623
|
-
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
1624
|
-
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
1625
|
-
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
1626
|
-
else:
|
1627
|
-
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
1628
|
-
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
1629
|
-
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
1630
|
-
|
1631
|
-
|
1632
1632
|
def doFlightInvoiceOCR(args, parsed_globals):
|
1633
1633
|
g_param = parse_global_arg(parsed_globals)
|
1634
1634
|
|
@@ -3085,6 +3085,58 @@ def doClassifyDetectOCR(args, parsed_globals):
|
|
3085
3085
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3086
3086
|
|
3087
3087
|
|
3088
|
+
def doRecognizeFormulaOCR(args, parsed_globals):
|
3089
|
+
g_param = parse_global_arg(parsed_globals)
|
3090
|
+
|
3091
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
3092
|
+
cred = credential.CVMRoleCredential()
|
3093
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
3094
|
+
cred = credential.STSAssumeRoleCredential(
|
3095
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
3096
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
3097
|
+
)
|
3098
|
+
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):
|
3099
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
3100
|
+
else:
|
3101
|
+
cred = credential.Credential(
|
3102
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
3103
|
+
)
|
3104
|
+
http_profile = HttpProfile(
|
3105
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
3106
|
+
reqMethod="POST",
|
3107
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
3108
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
3109
|
+
)
|
3110
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
3111
|
+
if g_param[OptionsDefine.Language]:
|
3112
|
+
profile.language = g_param[OptionsDefine.Language]
|
3113
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
3114
|
+
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
3115
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
3116
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
3117
|
+
model = models.RecognizeFormulaOCRRequest()
|
3118
|
+
model.from_json_string(json.dumps(args))
|
3119
|
+
start_time = time.time()
|
3120
|
+
while True:
|
3121
|
+
rsp = client.RecognizeFormulaOCR(model)
|
3122
|
+
result = rsp.to_json_string()
|
3123
|
+
try:
|
3124
|
+
json_obj = json.loads(result)
|
3125
|
+
except TypeError as e:
|
3126
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
3127
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
3128
|
+
break
|
3129
|
+
cur_time = time.time()
|
3130
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
3131
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
3132
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
3133
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
3134
|
+
else:
|
3135
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
3136
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
3137
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3138
|
+
|
3139
|
+
|
3088
3140
|
def doSealOCR(args, parsed_globals):
|
3089
3141
|
g_param = parse_global_arg(parsed_globals)
|
3090
3142
|
|
@@ -3605,6 +3657,58 @@ def doImageEnhancement(args, parsed_globals):
|
|
3605
3657
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3606
3658
|
|
3607
3659
|
|
3660
|
+
def doQuestionSplitOCR(args, parsed_globals):
|
3661
|
+
g_param = parse_global_arg(parsed_globals)
|
3662
|
+
|
3663
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
3664
|
+
cred = credential.CVMRoleCredential()
|
3665
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
3666
|
+
cred = credential.STSAssumeRoleCredential(
|
3667
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
3668
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
3669
|
+
)
|
3670
|
+
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):
|
3671
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
3672
|
+
else:
|
3673
|
+
cred = credential.Credential(
|
3674
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
3675
|
+
)
|
3676
|
+
http_profile = HttpProfile(
|
3677
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
3678
|
+
reqMethod="POST",
|
3679
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
3680
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
3681
|
+
)
|
3682
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
3683
|
+
if g_param[OptionsDefine.Language]:
|
3684
|
+
profile.language = g_param[OptionsDefine.Language]
|
3685
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
3686
|
+
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
3687
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
3688
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
3689
|
+
model = models.QuestionSplitOCRRequest()
|
3690
|
+
model.from_json_string(json.dumps(args))
|
3691
|
+
start_time = time.time()
|
3692
|
+
while True:
|
3693
|
+
rsp = client.QuestionSplitOCR(model)
|
3694
|
+
result = rsp.to_json_string()
|
3695
|
+
try:
|
3696
|
+
json_obj = json.loads(result)
|
3697
|
+
except TypeError as e:
|
3698
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
3699
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
3700
|
+
break
|
3701
|
+
cur_time = time.time()
|
3702
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
3703
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
3704
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
3705
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
3706
|
+
else:
|
3707
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
3708
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
3709
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
3710
|
+
|
3711
|
+
|
3608
3712
|
def doMLIDCardOCR(args, parsed_globals):
|
3609
3713
|
g_param = parse_global_arg(parsed_globals)
|
3610
3714
|
|
@@ -4437,7 +4541,7 @@ def doShipInvoiceOCR(args, parsed_globals):
|
|
4437
4541
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
4438
4542
|
|
4439
4543
|
|
4440
|
-
def
|
4544
|
+
def doReconstructDocument(args, parsed_globals):
|
4441
4545
|
g_param = parse_global_arg(parsed_globals)
|
4442
4546
|
|
4443
4547
|
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
@@ -4466,11 +4570,11 @@ def doRideHailingTransportLicenseOCR(args, parsed_globals):
|
|
4466
4570
|
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
4467
4571
|
client._sdkVersion += ("_CLI_" + __version__)
|
4468
4572
|
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
4469
|
-
model = models.
|
4573
|
+
model = models.ReconstructDocumentRequest()
|
4470
4574
|
model.from_json_string(json.dumps(args))
|
4471
4575
|
start_time = time.time()
|
4472
4576
|
while True:
|
4473
|
-
rsp = client.
|
4577
|
+
rsp = client.ReconstructDocument(model)
|
4474
4578
|
result = rsp.to_json_string()
|
4475
4579
|
try:
|
4476
4580
|
json_obj = json.loads(result)
|
@@ -4500,6 +4604,7 @@ MODELS_MAP = {
|
|
4500
4604
|
}
|
4501
4605
|
|
4502
4606
|
ACTION_MAP = {
|
4607
|
+
"QuestionOCR": doQuestionOCR,
|
4503
4608
|
"TextDetect": doTextDetect,
|
4504
4609
|
"QrcodeOCR": doQrcodeOCR,
|
4505
4610
|
"GeneralAccurateOCR": doGeneralAccurateOCR,
|
@@ -4510,7 +4615,7 @@ ACTION_MAP = {
|
|
4510
4615
|
"TrainTicketOCR": doTrainTicketOCR,
|
4511
4616
|
"PropOwnerCertOCR": doPropOwnerCertOCR,
|
4512
4617
|
"InvoiceGeneralOCR": doInvoiceGeneralOCR,
|
4513
|
-
"
|
4618
|
+
"RideHailingTransportLicenseOCR": doRideHailingTransportLicenseOCR,
|
4514
4619
|
"HKIDCardOCR": doHKIDCardOCR,
|
4515
4620
|
"MixedInvoiceOCR": doMixedInvoiceOCR,
|
4516
4621
|
"PermitOCR": doPermitOCR,
|
@@ -4530,7 +4635,6 @@ ACTION_MAP = {
|
|
4530
4635
|
"VehicleLicenseOCR": doVehicleLicenseOCR,
|
4531
4636
|
"BizLicenseOCR": doBizLicenseOCR,
|
4532
4637
|
"GetTaskState": doGetTaskState,
|
4533
|
-
"RecognizeGeneralCardWarn": doRecognizeGeneralCardWarn,
|
4534
4638
|
"FlightInvoiceOCR": doFlightInvoiceOCR,
|
4535
4639
|
"RecognizeThaiIDCardOCR": doRecognizeThaiIDCardOCR,
|
4536
4640
|
"TableOCR": doTableOCR,
|
@@ -4559,6 +4663,7 @@ ACTION_MAP = {
|
|
4559
4663
|
"HmtResidentPermitOCR": doHmtResidentPermitOCR,
|
4560
4664
|
"TollInvoiceOCR": doTollInvoiceOCR,
|
4561
4665
|
"ClassifyDetectOCR": doClassifyDetectOCR,
|
4666
|
+
"RecognizeFormulaOCR": doRecognizeFormulaOCR,
|
4562
4667
|
"SealOCR": doSealOCR,
|
4563
4668
|
"BankSlipOCR": doBankSlipOCR,
|
4564
4669
|
"ResidenceBookletOCR": doResidenceBookletOCR,
|
@@ -4569,6 +4674,7 @@ ACTION_MAP = {
|
|
4569
4674
|
"SmartStructuralPro": doSmartStructuralPro,
|
4570
4675
|
"RecognizeHealthCodeOCR": doRecognizeHealthCodeOCR,
|
4571
4676
|
"ImageEnhancement": doImageEnhancement,
|
4677
|
+
"QuestionSplitOCR": doQuestionSplitOCR,
|
4572
4678
|
"MLIDCardOCR": doMLIDCardOCR,
|
4573
4679
|
"RecognizeMedicalInvoiceOCR": doRecognizeMedicalInvoiceOCR,
|
4574
4680
|
"GeneralFastOCR": doGeneralFastOCR,
|
@@ -4585,7 +4691,7 @@ ACTION_MAP = {
|
|
4585
4691
|
"FormulaOCR": doFormulaOCR,
|
4586
4692
|
"PassportOCR": doPassportOCR,
|
4587
4693
|
"ShipInvoiceOCR": doShipInvoiceOCR,
|
4588
|
-
"
|
4694
|
+
"ReconstructDocument": doReconstructDocument,
|
4589
4695
|
|
4590
4696
|
}
|
4591
4697
|
|