huaweicloud-sdk-python-v3/examples/IoTDA/V5/BatchTaskfiles.py

50 lines
1.5 KiB
Python

# coding: utf-8
from huaweicloudsdkcore.http.http_config import HttpConfig
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkiotda.v5 import *
def deleteBatchTaskFile(client):
try:
request = DeleteBatchTaskFileRequest(file_id="5e971764-6e1b-4774-827a-e00d9d4e98c8")
response = client.delete_batch_task_file(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
def listBatchTaskFiles(client):
try:
request = ListBatchTaskFilesRequest()
response = client.list_batch_task_files(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
if __name__ == '__main__':
ak = "{your ak string}"
sk = "{your sk string}"
endpoint = "{your endpoint}"
project_id = "{your project id}"
config = HttpConfig.get_default_config()
config.ignore_ssl_verification = True
credentials = BasicCredentials(ak, sk, project_id)
iotda_client = IoTDAClient().new_builder(IoTDAClient) \
.with_http_config(config) \
.with_credentials(credentials) \
.with_endpoint(endpoint) \
.build()
deleteBatchTaskFile(iotda_client)
listBatchTaskFiles(iotda_client)