All Products
Search
Document Center

Content Moderation:Delete a business scenario

Last Updated:Jul 31, 2023

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.

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

Sample code

# coding=utf-8

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

# Note: We recommend that you reuse the instantiated client as much as possible. This improves moderation performance and avoids repeated client connections. 
# Common ways to obtain environment variables:
# Obtain the AccessKey ID of your RAM user: os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID']
# Obtain the AccessKey secret of your RAM user: os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET']
clt = client.AcsClient("We recommend that you obtain the AccessKey ID of your RAM user from environment variables", "We recommend that you obtain the AccessKey secret of your RAM user from environment variables", "cn-shanghai")
region_provider.modify_point('Green', "cn-shanghai", '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)