阿里云账号的 AccessKey ID 和 AccessKey Secret 可以从 AccessKey 管理 获取。
AccessKey ID 和 AccessKey Secret 属于您的个人敏感信息,请妥善保管,谨防泄露。
import time
from Tea.exceptions import TeaException
from alibabacloud_tea_openapi import models
from alibabacloud_aiearth_engine20220609.models import *
from alibabacloud_aiearth_engine20220609.client import Client
config = models.Config(
# 您的AccessKey ID,
access_key_id='*请替换*',
# 您的AccessKey Secret,
access_key_secret='*请替换*',
# 地域ID
region_id='cn-hangzhou',
# 访问的域名
endpoint='aiearth-engine.cn-hangzhou.aliyuncs.com'
)
client = Client(config)
try:
createAIJobRequest = CreateAIJobRequest()
createAIJobRequest.job_name = '*请替换*'
createAIJobRequest.app = '*请替换*'
createAIJobRequest.area_threshold = 0
createAIJobRequest.confidence = 10
createAIJobRequestInputs = CreateAIJobRequestInputs()
createAIJobRequestInputs.idx = 1
createAIJobRequestInputsSrc = CreateAIJobRequestInputsSrc()
createAIJobRequestInputsSrc.data_id = '*请替换*'
createAIJobRequestInputs.src = createAIJobRequestInputsSrc
createAIJobRequest.inputs = [createAIJobRequestInputs]
aijob: CreateAIJobResponse = client.create_aijob(createAIJobRequest)
print(aijob.body)
jobId = aijob.body.jobs[0].job_id
except TeaException as e:
# 打印整体的错误输出
print(e)
# 打印错误码
print(e.code)
# 打印错误信息,错误信息中包含
print(e.message)
# 打印服务端返回的具体错误内容
print(e.data)
try:
getJobsRequest = GetJobsRequest()
getJobsRequest.job_ids = [jobId]
jobs: GetJobsResponse = client.get_jobs(getJobsRequest)
print(jobs.body)
except TeaException as e:
# 打印整体的错误输出
print(e)
# 打印错误码
print(e.code)
# 打印错误信息,错误信息中包含
print(e.message)
# 打印服务端返回的具体错误内容
print(e.data)
try:
deleteJobsRequest = DeleteJobsRequest()
deleteJobsRequest.job_ids = [jobId]
del_jobs: DeleteJobsResponse = client.delete_jobs(deleteJobsRequest)
print(del_jobs.body)
except TeaException as e:
# 打印整体的错误输出
print(e)
# 打印错误码
print(e.code)
# 打印错误信息,错误信息中包含
print(e.message)
# 打印服务端返回的具体错误内容
print(e.data)