This topic describes how to use Content Moderation SDK for Python to delete a business scenario. If you need to delete a business scenario, make sure that the business scenario is not in use. If you use a deleted business scenario, the moderation policy that is customized based on the business scenario becomes unavailable and the default moderation policy is used. This may lead to errors in the moderation of business data.

Prerequisites

  • Python dependencies are installed. For more information, see Installation.
    Note You must use the required Python version described in the Installation topic to install the dependencies. Otherwise, subsequent operation calls fail.
  • The Extension.Uploader utility class is downloaded and imported into your project if you want to submit a local image or a binary image stream for image moderation.

Submit a task to delete a business scenario

Operation Description Supported region
DeleteBizType Deletes a business scenario.
  • cn-shanghai: China (Shanghai)
  • cn-beijing: China (Beijing)
  • cn-shenzhen: China (Shenzhen)
  • ap-southeast-1: Singapore (Singapore)

Sample code

# coding=utf-8


from aliyunsdkcore import client
from aliyunsdkcore.profile import region_provider
from aliyunsdkgreen.request.v20170823 import DeleteBizTypeRequest

# Use the AccessKey ID and AccessKey secret of your Alibaba Cloud account. 
clt = client.AcsClient(Your AccessKey ID, Your AccessKey secret, Region ID)


region_provider.modify_point('Green', regionId, 'green.cn-shanghai.aliyuncs.com')
request = DeleteBizTypeRequest.DeleteBizTypeRequest()
# Specify the name of the business scenario that you want to delete. 
request.set_BizTypeName(The name of the business scenario)

request.set_accept_format('JSON')

response = clt.do_action_with_exception(request)
print(response)