zs_ai_pre_3d_render_script.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from __future__ import (
  2. print_function,
  3. ) # Ensure print() function is available in Python 2
  4. import sys
  5. import json
  6. import requests
  7. from Deadline.Scripting import * # type: ignore # Import Deadline script utilities
  8. api_path = "https://canvas-api-test.anvil.app/_/api"
  9. def update_3d_image_task_status(row_id, new_status):
  10. # Define the URL for the API endpoint
  11. url = "{}/creation-module/3d-image/update-status".format(api_path)
  12. # Create a JSON payload
  13. payload = {"row_id": row_id, "new_status": new_status}
  14. # Make a POST request to the API endpoint with the JSON payload
  15. response = requests.post(url, json=payload)
  16. # Handle the response
  17. if response.status_code == 200:
  18. print("Status update was successful")
  19. return response.json()
  20. else:
  21. print("Status update failed")
  22. print("Status code:", response.status_code)
  23. print("Response:", response.text)
  24. return None
  25. def __main__(*args):
  26. deadlinePlugin = args[0]
  27. job = deadlinePlugin.GetJob()
  28. row_id = job.JobExtraInfo0
  29. update_3d_image_task_status(row_id=row_id, new_status=2)