All Products
Search
Document Center

ImageAsyncScanResultsRequest

Last Updated: Jun 06, 2019

Interface description

An interface used to obtain the asynchronous image moderation results

SDK interface

  1. ImageAsyncScanResultsRequest

region

  1. ap-southeast-1

Depended interface

ImageAsyncScanResultsRequest is applied after ImageAsyncScanRequest is used to perform asynchronous image moderation (the interface assigns a taskId to every image), and obtains asynchronous image moderation results based on the taskIds.

Sample code

  1. #coding=utf-8
  2. from aliyunsdkcore import client
  3. from aliyunsdkcore.profile import region_provider
  4. from aliyunsdkgreen.request.v20170112 import ImageAsyncScanResultsRequest
  5. import json
  6. import uuid
  7. import datetime
  8. # Replace with your accessKeyId and accessKeySecret
  9. clt = client.AcsClient("your accessKeyId", "your accessKeySecret",'ap-southeast-1')
  10. region_provider.modify_point('Green', 'ap-southeast-1', 'green.ap-southeast-1.aliyuncs.com')
  11. request = ImageAsyncScanResultsRequest.ImageAsyncScanResultsRequest()
  12. request.set_accept_format('JSON')
  13. taskIds = ["e4c72f02-8120-41b6-a7ee-66684a6936f8-1492678445660"]
  14. request.set_content(bytearray(json.dumps(taskIds), "utf-8"))
  15. response = clt.do_action(request)
  16. print response
  17. result = json.loads(response)
  18. if 200 == result["code"]:
  19. taskResults = result["data"]
  20. for taskResult in taskResults:
  21. if (200 == taskResult["code"]):
  22. sceneResults = taskResult["results"]
  23. for sceneResult in sceneResults:
  24. scene = sceneResult["scene"]
  25. suggestion = sceneResult["suggestion"]
  26. print suggestion
  27. print scene
  28. #Post actions according to scene and suggestion in returned results
  29. #do something