tccli-intl-en 3.0.1284.1__py2.py3-none-any.whl → 3.1.2.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/ckafka/ckafka_client.py +288 -8
- tccli/services/ckafka/v20190819/api.json +494 -76
- tccli/services/ckafka/v20190819/examples.json +45 -5
- tccli/services/clb/v20180317/api.json +994 -634
- tccli/services/clb/v20180317/examples.json +19 -19
- tccli/services/cvm/v20170312/examples.json +2 -2
- tccli/services/ocr/ocr_client.py +112 -0
- tccli/services/ocr/v20181119/api.json +505 -0
- tccli/services/ocr/v20181119/examples.json +22 -0
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/METADATA +2 -2
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/RECORD +16 -16
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/LICENSE +0 -0
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/WHEEL +0 -0
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/entry_points.txt +0 -0
- {tccli_intl_en-3.0.1284.1.dist-info → tccli_intl_en-3.1.2.1.dist-info}/top_level.txt +0 -0
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"BatchDeregisterTargets": [
|
|
20
20
|
{
|
|
21
|
-
"document": "
|
|
22
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: BatchDeregisterTargets\n<
|
|
23
|
-
"output": "{\n \"Response\": {\n \"FailListenerIdSet\": [],\n \"RequestId\": \"83129908-a282-4f9f-8ab-131a3025ba22\"\n }\n}",
|
|
24
|
-
"title": "Unbinding
|
|
21
|
+
"document": "",
|
|
22
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: BatchDeregisterTargets\n<common params>\n\n{\n \"Targets\": [\n {\n \"InstanceId\": \"ins-xxx\",\n \"ListenerId\": \"lbl-xxxx\",\n \"Weight\": 10,\n \"Port\": 80\n }\n ],\n \"LoadBalancerId\": \"lb-xxxx\"\n}",
|
|
23
|
+
"output": "{\n \"Response\": {\n \"FailListenerIdSet\": [],\n \"Message\": \"\",\n \"RequestId\": \"83129908-a282-4f9f-8ab-131a3025ba22\"\n }\n}",
|
|
24
|
+
"title": "Unbinding CVM instances"
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
27
|
"BatchModifyTargetTag": [
|
|
28
28
|
{
|
|
29
29
|
"document": "",
|
|
30
30
|
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: BatchModifyTargetTag\n<Common request parameters>\n\n\n\n{\n \"LoadBalancerId\": \"lb-xxxxxxxx\",\n \"ModifyList\": [\n {\n \"ListenerId\": \"lbl-yyyyyyyy\",\n \"Targets\": [\n {\n \"Port\": 1000,\n \"EniIp\": \"1.1.1.1\",\n \"Tag\": \"xxxx\"\n }\n ]\n }\n ]\n}",
|
|
31
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"
|
|
31
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"9cc30f1d-c237-422a-87ff-8f08c31a46e6\"\n }\n}",
|
|
32
32
|
"title": "Setting Tags"
|
|
33
33
|
}
|
|
34
34
|
],
|
|
@@ -73,31 +73,31 @@
|
|
|
73
73
|
"CreateListener": [
|
|
74
74
|
{
|
|
75
75
|
"document": "This example shows you how to create an HTTPS listener and bind an existing certificate.",
|
|
76
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n
|
|
77
|
-
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-
|
|
76
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n{\n \"Protocol\": \"HTTPS\",\n \"Ports\": [\n 7572\n ],\n \"Certificate\": {\n \"SSLMode\": \"UNIDIRECTIONAL\",\n \"CertId\": \"MsJyaXVm\"\n },\n \"LoadBalancerId\": \"lb-cuxw2rm0\"\n}",
|
|
77
|
+
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-4fbxq45k\"\n ],\n \"RequestId\": \"db8ae69f-ebda-402b-8d02-ead459aa6ff9\"\n }\n}",
|
|
78
78
|
"title": "Creating an HTTPS Listener and Binding an Existing Certificate"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"document": "This example shows you how to create a TCP listener and configure the health check settings.",
|
|
82
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n
|
|
83
|
-
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-
|
|
82
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n{\n \"HealthCheck\": {\n \"UnHealthNum\": \"4\",\n \"HealthNum\": \"4\",\n \"IntervalTime\": \"7\",\n \"TimeOut\": \"5\",\n \"HealthSwitch\": \"1\"\n },\n \"Protocol\": \"TCP\",\n \"Ports\": [\n 7571\n ],\n \"LoadBalancerId\": \"lb-cuxw2rm0\"\n}",
|
|
83
|
+
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-lbbxvq26\"\n ],\n \"RequestId\": \"fff13c83-dcb5-481a-ba7c-30e92c276c19\"\n }\n}",
|
|
84
84
|
"title": "Creating a TCP Listener and Configuring the Health Check Settings"
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"document": "This example shows you how to create an HTTPS listener and bind a new certificate.",
|
|
88
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n
|
|
89
|
-
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-
|
|
88
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n{\n \"Protocol\": \"HTTPS\",\n \"Ports\": [\n 7573\n ],\n \"Certificate\": {\n \"SSLMode\": \"UNIDIRECTIONAL\",\n \"CertContent\": \"-----BEGINCERTIFICATE-----\\\\nxxxxxxxxxxxxxxxxxxxxxxx\\\\n-----ENDCERTIFICATE-----\",\n \"CertName\": \"my-cert\",\n \"CertKey\": \"-----BEGINRSAPRIVATEKEY-----\\\\nxxxxxxxxxxxxxxxxxxxxxxxx\\\\n-----ENDRSAPRIVATEKEY-----\"\n },\n \"LoadBalancerId\": \"lb-cuxw2rm0\"\n}",
|
|
89
|
+
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-bzfmg9m6\"\n ],\n \"RequestId\": \"6082314c-030c-429d-9eae-2dc6b159b5b9\"\n }\n}",
|
|
90
90
|
"title": "Creating an HTTPS Listener and Binding a New Certificate"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"document": "This example shows you how to create a UDP listener with the default Ping health check.",
|
|
94
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n
|
|
94
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n{\n \"HealthCheck\": {\n \"HealthSwitch\": \"1\"\n },\n \"Protocol\": \"UDP\",\n \"ListenerNames\": [\n \"lis_test\"\n ],\n \"Ports\": [\n 432\n ],\n \"LoadBalancerId\": \"lb-6wlxe9rj\"\n}",
|
|
95
95
|
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-aev333n1\"\n ],\n \"RequestId\": \"3b81f03e-6088-448d-abaf-8a487d4f985a\"\n }\n}",
|
|
96
96
|
"title": "Creating a UDP Listener with the Default Ping Health Check"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"document": "This example shows you how to create two TCP listeners (respectively named lis0 and lis1) to respectively listen on ports 7569 and 7570.",
|
|
100
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n
|
|
100
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateListener\n<Common request parameters>\n\n{\n \"ListenerNames\": [\n \"lis1\",\n \"lis0\"\n ],\n \"Protocol\": \"TCP\",\n \"Ports\": [\n 7570,\n 7569\n ],\n \"LoadBalancerId\": \"lb-cuxw2rm0\"\n}",
|
|
101
101
|
"output": "{\n \"Response\": {\n \"ListenerIds\": [\n \"lbl-d1ubsydq\",\n \"lbl-4udz130k\"\n ],\n \"RequestId\": \"8f272cef-14ff-458c-b67e-1bd21bd2942b\"\n }\n}",
|
|
102
102
|
"title": "Creating Two TCP Listeners (Respectively Named lis0 and lis1) to Respectively Listen on Ports 7569 and 7570"
|
|
103
103
|
}
|
|
@@ -627,13 +627,13 @@
|
|
|
627
627
|
"ModifyListener": [
|
|
628
628
|
{
|
|
629
629
|
"document": "This example shows you how to modify the certificate bound to an HTTPS listener.",
|
|
630
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyListener\n<Common request parameters>\n\n
|
|
630
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyListener\n<Common request parameters>\n\n{\n \"ListenerId\": \"lbl-4fbxq45k\",\n \"Certificate\": {\n \"SSLMode\": \"UNIDIRECTIONAL\",\n \"CertId\": \"Nb1DY3hQ\"\n },\n \"LoadBalancerId\": \"lb-cuxw2rm0\"\n}",
|
|
631
631
|
"output": "{\n \"Response\": {\n \"RequestId\": \"b64574f9-5bc7-4a63-a9d7-3671b6a6d62b\"\n }\n}",
|
|
632
632
|
"title": "Modifying the Certificate Bound to an HTTPS Listener"
|
|
633
633
|
},
|
|
634
634
|
{
|
|
635
635
|
"document": "This example shows you how to modify the name, health check parameters, and forwarding policy of a TCP listener.",
|
|
636
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyListener\n<Common request parameters>\n\n
|
|
636
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyListener\n<Common request parameters>\n\n{\n \"HealthCheck\": {\n \"UnHealthNum\": 5,\n \"HealthNum\": 5,\n \"IntervalTime\": 60,\n \"TimeOut\": 35,\n \"HealthSwitch\": 1\n },\n \"LoadBalancerId\": \"lb-cuxw2rm0\",\n \"ListenerId\": \"lbl-d1ubsydq\",\n \"ListenerName\": \"newlis\",\n \"Scheduler\": \"LEAST_CONN\",\n \"SessionExpireTime\": 120\n}",
|
|
637
637
|
"output": "{\n \"Response\": {\n \"RequestId\": \"8cd88c83-fd30-47c0-8e7a-89bf13a7a83c\"\n }\n}",
|
|
638
638
|
"title": "Modifying the Name, Health Check Parameters, and Forwarding Policy of a TCP Listener"
|
|
639
639
|
}
|
|
@@ -648,10 +648,10 @@
|
|
|
648
648
|
],
|
|
649
649
|
"ModifyLoadBalancerSla": [
|
|
650
650
|
{
|
|
651
|
-
"document": "
|
|
652
|
-
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyLoadBalancerSla\n<Common request
|
|
651
|
+
"document": "When upgrading a pay-as-you-go shared instance to a performance capacity instance, or adjusting the specifications of a performance capacity instance, the final instance specification is determined by the SlaType value set as needed.",
|
|
652
|
+
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyLoadBalancerSla\n<Common request params>\n\n{\n \"LoadBalancerSla\": [\n {\n \"SlaType\": \"clb.c3.medium\",\n \"LoadBalancerId\": \"lb-db2n****\"\n }\n ]\n}",
|
|
653
653
|
"output": "{\n \"Response\": {\n \"RequestId\": \"c1157c81-f3dc-4f2a-9346-76f161d548eb\"\n }\n}",
|
|
654
|
-
"title": "
|
|
654
|
+
"title": "Loadbalancer specification adjustment"
|
|
655
655
|
}
|
|
656
656
|
],
|
|
657
657
|
"ModifyLoadBalancersProject": [
|
|
@@ -808,7 +808,7 @@
|
|
|
808
808
|
{
|
|
809
809
|
"document": "This example shows you how to enable or disable a CLB instance.",
|
|
810
810
|
"input": "POST / HTTP/1.1\nHost: clb.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: SetLoadBalancerStartStatus\n<Common request parameters>\n\n\n\n{\n \"LoadBalancerId\": \"lb-xxxxxxxx\",\n \"OperationType\": \"Stop\"\n}",
|
|
811
|
-
"output": "{\n \"Response\": {\n \"RequestId\": \"
|
|
811
|
+
"output": "{\n \"Response\": {\n \"RequestId\": \"b3196d4c-2722-4893-8d86-e33136199469\"\n }\n}",
|
|
812
812
|
"title": "Enabling or Disabling a CLB Instance"
|
|
813
813
|
}
|
|
814
814
|
],
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
"DescribeInternetChargeTypeConfigs": [
|
|
276
276
|
{
|
|
277
277
|
"document": "This example shows you how to query the list of all network billing modes and select one for the CVM created using the API.",
|
|
278
|
-
"input": "POST / HTTP/1.1\nHost: cvm.intl.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeInternetChargeTypeConfigs\n<Common request parameters>\n\n{}",
|
|
278
|
+
"input": "POST / HTTP/1.1\nHost: cvm.intl.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeInternetChargeTypeConfigs\nX-TC-Language: en-US\n<Common request parameters>\n\n{}",
|
|
279
279
|
"output": "{\n \"Response\": {\n \"InternetChargeTypeConfigSet\": [\n {\n \"InternetChargeType\": \"BANDWIDTH_PREPAID\",\n \"Description\": \"Bill by monthly bandwidth subscription\"\n },\n {\n \"InternetChargeType\": \"TRAFFIC_POSTPAID_BY_HOUR\",\n \"Description\": \"Bill by traffic\"\n },\n {\n \"InternetChargeType\": \"BANDWIDTH_POSTPAID_BY_HOUR\",\n \"Description\": \"Bill by bandwidth usage period\"\n },\n {\n \"InternetChargeType\": \"BANDWIDTH_PACKAGE\",\n \"Description\": \"Bill by bandwidth package\"\n }\n ],\n \"RequestId\": \"c2abdac4-ea7b-4653-b07c-87cc303fabf0\"\n }\n}",
|
|
280
280
|
"title": "Querying network billing modes"
|
|
281
281
|
}
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
],
|
|
517
517
|
"ModifyImageAttribute": [
|
|
518
518
|
{
|
|
519
|
-
"document": "This example shows you how to rename the image `img-6pb6lrmy` to `
|
|
519
|
+
"document": "This example shows you how to rename the image `img-6pb6lrmy` to `NewImageName`.",
|
|
520
520
|
"input": "POST / HTTP/1.1\nHost: cvm.intl.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyImageAttribute\n<Common request parameters>\n\n{\n \"ImageId\": \"img-6pb6lrmy\",\n \"ImageName\": \"NewImageName\"\n}",
|
|
521
521
|
"output": "{\n \"Response\": {\n \"RequestId\": \"71e69b56-32be-4412-ab45-49eded6a87be\"\n }\n}",
|
|
522
522
|
"title": "Modifying image name"
|
tccli/services/ocr/ocr_client.py
CHANGED
|
@@ -622,6 +622,61 @@ def doRecognizeBrazilRNEOCR(args, parsed_globals):
|
|
|
622
622
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
623
623
|
|
|
624
624
|
|
|
625
|
+
def doApplyCardVerificationExternal(args, parsed_globals):
|
|
626
|
+
g_param = parse_global_arg(parsed_globals)
|
|
627
|
+
|
|
628
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
629
|
+
cred = credential.CVMRoleCredential()
|
|
630
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
631
|
+
cred = credential.STSAssumeRoleCredential(
|
|
632
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
633
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
634
|
+
)
|
|
635
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
636
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
637
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
638
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
639
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
640
|
+
else:
|
|
641
|
+
cred = credential.Credential(
|
|
642
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
643
|
+
)
|
|
644
|
+
http_profile = HttpProfile(
|
|
645
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
646
|
+
reqMethod="POST",
|
|
647
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
648
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
649
|
+
)
|
|
650
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
651
|
+
if g_param[OptionsDefine.Language]:
|
|
652
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
653
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
654
|
+
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
655
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
656
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
657
|
+
model = models.ApplyCardVerificationExternalRequest()
|
|
658
|
+
model.from_json_string(json.dumps(args))
|
|
659
|
+
start_time = time.time()
|
|
660
|
+
while True:
|
|
661
|
+
rsp = client.ApplyCardVerificationExternal(model)
|
|
662
|
+
result = rsp.to_json_string()
|
|
663
|
+
try:
|
|
664
|
+
json_obj = json.loads(result)
|
|
665
|
+
except TypeError as e:
|
|
666
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
667
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
668
|
+
break
|
|
669
|
+
cur_time = time.time()
|
|
670
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
671
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
672
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
673
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
674
|
+
else:
|
|
675
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
676
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
677
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
678
|
+
|
|
679
|
+
|
|
625
680
|
def doHKIDCardOCR(args, parsed_globals):
|
|
626
681
|
g_param = parse_global_arg(parsed_globals)
|
|
627
682
|
|
|
@@ -842,6 +897,61 @@ def doRecognizeThaiIDCardOCR(args, parsed_globals):
|
|
|
842
897
|
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
843
898
|
|
|
844
899
|
|
|
900
|
+
def doGetCardVerificationExternalResult(args, parsed_globals):
|
|
901
|
+
g_param = parse_global_arg(parsed_globals)
|
|
902
|
+
|
|
903
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
|
904
|
+
cred = credential.CVMRoleCredential()
|
|
905
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
|
906
|
+
cred = credential.STSAssumeRoleCredential(
|
|
907
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
|
908
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
|
909
|
+
)
|
|
910
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) \
|
|
911
|
+
and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) \
|
|
912
|
+
and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) \
|
|
913
|
+
and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
|
914
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
|
915
|
+
else:
|
|
916
|
+
cred = credential.Credential(
|
|
917
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
|
918
|
+
)
|
|
919
|
+
http_profile = HttpProfile(
|
|
920
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
|
921
|
+
reqMethod="POST",
|
|
922
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
|
923
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
|
924
|
+
)
|
|
925
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="TC3-HMAC-SHA256")
|
|
926
|
+
if g_param[OptionsDefine.Language]:
|
|
927
|
+
profile.language = g_param[OptionsDefine.Language]
|
|
928
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
|
929
|
+
client = mod.OcrClient(cred, g_param[OptionsDefine.Region], profile)
|
|
930
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
|
931
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
|
932
|
+
model = models.GetCardVerificationExternalResultRequest()
|
|
933
|
+
model.from_json_string(json.dumps(args))
|
|
934
|
+
start_time = time.time()
|
|
935
|
+
while True:
|
|
936
|
+
rsp = client.GetCardVerificationExternalResult(model)
|
|
937
|
+
result = rsp.to_json_string()
|
|
938
|
+
try:
|
|
939
|
+
json_obj = json.loads(result)
|
|
940
|
+
except TypeError as e:
|
|
941
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
|
942
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
|
943
|
+
break
|
|
944
|
+
cur_time = time.time()
|
|
945
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
|
946
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
|
947
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
|
948
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
|
949
|
+
else:
|
|
950
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
|
951
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
|
952
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
|
953
|
+
|
|
954
|
+
|
|
845
955
|
def doRecognizeMacaoIDCardOCR(args, parsed_globals):
|
|
846
956
|
g_param = parse_global_arg(parsed_globals)
|
|
847
957
|
|
|
@@ -2184,10 +2294,12 @@ ACTION_MAP = {
|
|
|
2184
2294
|
"VinOCR": doVinOCR,
|
|
2185
2295
|
"MLIDPassportOCR": doMLIDPassportOCR,
|
|
2186
2296
|
"RecognizeBrazilRNEOCR": doRecognizeBrazilRNEOCR,
|
|
2297
|
+
"ApplyCardVerificationExternal": doApplyCardVerificationExternal,
|
|
2187
2298
|
"HKIDCardOCR": doHKIDCardOCR,
|
|
2188
2299
|
"GeneralBasicOCR": doGeneralBasicOCR,
|
|
2189
2300
|
"PermitOCR": doPermitOCR,
|
|
2190
2301
|
"RecognizeThaiIDCardOCR": doRecognizeThaiIDCardOCR,
|
|
2302
|
+
"GetCardVerificationExternalResult": doGetCardVerificationExternalResult,
|
|
2191
2303
|
"RecognizeMacaoIDCardOCR": doRecognizeMacaoIDCardOCR,
|
|
2192
2304
|
"RecognizeBrazilCommonOCR": doRecognizeBrazilCommonOCR,
|
|
2193
2305
|
"TableOCR": doTableOCR,
|