This topic describes how to use Content Moderation SDK for Python to create a business scenario. You can use the business scenario to customize a policy for machine-assisted moderation for the Content Moderation API.

Before you begin

Before you call operations, make the following preparations:

Submit a task to create a business scenario

Operation Description Supported region
CreateBizType Creates 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 CreateBizTypeRequest

# 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, '')
request = CreateBizTypeRequest.CreateBizTypeRequest()
# Set the name of the business scenario that you want to create. 
request.set_BizTypeName("The name of the business scenario")
# Import the configuration of an existing business scenario. This parameter is optional. 
request.set_BizTypeImport("The name of an existing business scenario to be imported")
# Specify whether to import the configuration of an industry template. If you set this parameter to true, you must specify the IndustryInfo parameter. This parameter is optional. 
# Specify the industry classification. This parameter is required if you set the CiteTemplate parameter to true. Valid values: Social-Registration information-Profile picture and Social-Registration information-Nickname. 
request.set_IndustryInfo("Social-Registration information-Profile picture")


response = clt.do_action_with_exception(request)