zs_ai_utilities.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import requests
  2. def update_3d_image_task_status(row_id, new_status):
  3. # Define the URL for the API endpoint
  4. url = "https://your-anvil-app-url/_/api/update_3d_image_task_status"
  5. # Create a JSON payload
  6. payload = {"row_id": row_id, "new_status": new_status}
  7. # Make a POST request to the API endpoint with the JSON payload
  8. response = requests.post(url, json=payload)
  9. # Handle the response
  10. if response.status_code == 200:
  11. print("Status update was successful")
  12. return response.json()
  13. else:
  14. print("Status update failed")
  15. print("Status code:", response.status_code)
  16. print("Response:", response.text)
  17. return None
  18. def get_3d_image_task(row_id):
  19. # Define the URL for the API endpoint
  20. url = f"https://your-anvil-app-url/_/api/get_3d_image_task/{row_id}"
  21. # Make a GET request to the API endpoint
  22. response = requests.get(url)
  23. # Handle the response
  24. if response.status_code == 200:
  25. print("Request was successful")
  26. return response.json()
  27. else:
  28. print("Request failed")
  29. print("Status code:", response.status_code)
  30. print("Response:", response.text)
  31. return None
  32. # Example usage
  33. result = get_3d_image_task("example_row_id")
  34. print(result)