Help Center/
Content Moderation/
SDK Reference/
Using the Python SDK/
SDK Calling Example/
Moderation (Video)/
Creating a Video Moderation Job
Updated on 2025-07-02 GMT+08:00
Creating a Video Moderation Job
- This section describes how to create a video moderation job using the video moderation SDK and AK/SK.
In the sample code, you can use withUrls of the RunCreateVideoModerationJobRequest class to configure the URL of the video to be reviewed (only the URL mode is supported). After the configuration is complete, run the code.
# coding: utf-8 from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdkmoderation.v3.region.moderation_region import ModerationRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkmoderation.v3 import * import os if __name__ == "__main__": # Hard-coded or plaintext AK and SK are risky. For security purposes, encrypt your AK and SK and store them in the configuration file or environment variables. # In this example, the AK and SK are stored in environment variables for identity authentication. Before running this example, configure environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. ak = os.getenv("HUAWEICLOUD_SDK_AK") sk = os.getenv("HUAWEICLOUD_SDK_SK") credentials = BasicCredentials(ak, sk) \ client = ModerationClient.new_builder() \ .with_credentials(credentials) \ .with_region(ModerationRegion.value_of("xxx")) \ .build() # Replace xxx with the service region, for example, ap-southeast-3. try: request = RunCreateVideoModerationJobRequest() listAudioCategoriesbody = [ "porn" ] listImageCategoriesbody = [ "porn" ] databody = VideoCreateRequestData( url="http://xxx.xx.xxxx", frame_interval=5.5 ) request.body = VideoCreateRequest( callback="http://xxx.xx.xxxx", audio_categories=listAudioCategoriesbody, image_categories=listImageCategoriesbody, event_type="default", data=databody ) response = client.run_create_video_moderation_job(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
- The console returns the submission result of the creation request and the video moderation job creation result.
{"request_id": "dbbcb75d1a174bfa899a38be38fdd107", "job_id": "xxx"}
Parent topic: Moderation (Video)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot