From 53e48ab4a1f53419cc654ec3b1fb3c67dbb52b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LORRAIN?= Date: Tue, 26 Oct 2021 15:39:14 +0200 Subject: [PATCH] shotgrid manager batch interface --- .../default_modules/shotgrid/lib/server.py | 22 +++--- .../shotgrid/manager/index.html | 8 +- .../shotgrid/manager/js/manager.js | 79 +++++++++++++------ .../shotgrid/tray/manager_api.py | 25 +++--- .../shotgrid/tray/shotgrid_tray.py | 18 +++-- 5 files changed, 98 insertions(+), 54 deletions(-) diff --git a/openpype/modules/default_modules/shotgrid/lib/server.py b/openpype/modules/default_modules/shotgrid/lib/server.py index e115655b9f5..1dd18f8cf62 100644 --- a/openpype/modules/default_modules/shotgrid/lib/server.py +++ b/openpype/modules/default_modules/shotgrid/lib/server.py @@ -1,3 +1,5 @@ +import traceback + import requests from typing import Dict, Any from openpype.modules.default_modules.shotgrid.lib import ( @@ -22,10 +24,11 @@ def poll_server() -> int: def check_batch_settings( - project: str, url: str, script_name: str, api_key: str, project_id: int + url: str, script_name: str, api_key: str, project_id: int ) -> bool: module_url = _format_url(settings_lib.get_module_server_url()) - api_url = "/".join([module_url, "batch", project, "check"]) + api_url = "/".join([module_url, "batch", "check"]) + print(api_url) params = { "shotgrid_url": url, "shotgrid_project_id": project_id, @@ -35,13 +38,9 @@ def check_batch_settings( try: res = requests.get(api_url, params=params) + return {"status_code": res.status_code, "payload": res.json()} except requests.exceptions.RequestException: - return False - - if res.status_code == 200: - return res.json().get("status", "KO") == "OK" - else: - return False + traceback.print_stack() def send_batch_request( @@ -67,7 +66,6 @@ def send_batch_request( try: res = requests.post(api_url, json=payload) - except requests.exceptions.RequestException: - return 404 - - return res.status_code + return {"status_code": res.status_code, "payload": res.json()} + except requests.exceptions.RequestException as e: + traceback.print_stack() diff --git a/openpype/modules/default_modules/shotgrid/manager/index.html b/openpype/modules/default_modules/shotgrid/manager/index.html index 601990ce952..8e113e006a7 100644 --- a/openpype/modules/default_modules/shotgrid/manager/index.html +++ b/openpype/modules/default_modules/shotgrid/manager/index.html @@ -9,6 +9,7 @@ + Shotgrid Manager @@ -28,18 +29,19 @@