35 lines
1.6 KiB
Python
35 lines
1.6 KiB
Python
|
from typing import List
|
|||
|
from alibabacloud_docmind_api20220711.client import Client as docmind_api20220711Client
|
|||
|
from alibabacloud_tea_openapi import models as open_api_models
|
|||
|
from alibabacloud_docmind_api20220711 import models as docmind_api20220711_models
|
|||
|
from alibabacloud_tea_util.client import Client as UtilClient
|
|||
|
from alibabacloud_credentials.client import Client as CredClient
|
|||
|
|
|||
|
def query():
|
|||
|
# 使用默认凭证初始化Credentials Client。
|
|||
|
cred=CredClient()
|
|||
|
config = open_api_models.Config(
|
|||
|
# 通过credentials获取配置中的AccessKey ID
|
|||
|
cred.get_credential().access_key_id,
|
|||
|
# 通过credentials获取配置中的AccessKey Secret
|
|||
|
cred.get_credential().access_key_secret,
|
|||
|
)
|
|||
|
# 访问的域名
|
|||
|
config.endpoint = f'docmind-api.cn-hangzhou.aliyuncs.com'
|
|||
|
client = docmind_api20220711Client(config)
|
|||
|
request = docmind_api20220711_models.GetDocParserResultRequest(
|
|||
|
# id : 任务提交接口返回的id
|
|||
|
id='docmind-20241008-24363df30d274863894f037dbb7244e8',
|
|||
|
layout_step_size=10,
|
|||
|
layout_num=0
|
|||
|
)
|
|||
|
try:
|
|||
|
# 复制代码运行请自行打印 routes 的返回值
|
|||
|
response = client.get_doc_parser_result(request)
|
|||
|
# API返回值格式层级为 body -> data -> 具体属性。可根据业务需要打印相应的结果。获取属性值均以小写开头
|
|||
|
# 获取返回结果。建议先把response.body.data转成json,然后再从json里面取具体需要的值。
|
|||
|
print(response.body.data)
|
|||
|
except Exception as error:
|
|||
|
# 如有需要,请打印 error
|
|||
|
UtilClient.assert_as_string(error.message)
|
|||
|
query()
|