Skip to content

Commit

Permalink
Merge pull request #179 from ynput/enhancement/update-ayon-api
Browse files Browse the repository at this point in the history
Chore: Update ayon api
  • Loading branch information
iLLiCiTiT authored Oct 15, 2024
2 parents 0fbafee + 75ef28b commit 116665f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions start.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ def _print(message: str):
get_addons_studio_settings,
get_event,
update_event,
take_web_action_event,
abort_web_action_event,
)
from ayon_api.constants import ( # noqa E402
SERVER_URL_ENV_KEY,
Expand Down Expand Up @@ -741,9 +743,7 @@ def process_uri():
server_url = parsed_query["server_url"][0]
uri_token = parsed_query["token"][0]
# Use raw requests to get all necessary information from server
response = requests.get(f"{server_url}/api/actions/take/{uri_token}")
# TODO validate response
data = response.json()
data = take_web_action_event(server_url, uri_token)
username = data.get("userName")

os.environ[SERVER_URL_ENV_KEY] = server_url
Expand All @@ -755,9 +755,15 @@ def process_uri():
_connect_to_ayon_server(username=username)
except SystemExit:
try:
# There is a bug in ayon-python-api 1.0.10
# abort_web_action_event(
# server_url,
# uri_token,
# "User skipped login in AYON launcher.",
# )
requests.post(
f"{server_url}/api/actions/abort/{uri_token}",
json={"message": "User skipped login in AYON launcher."}
json={"message": "User skipped login in AYON launcher."},
)
except Exception:
# Silently ignore any exception, only print traceback
Expand Down

0 comments on commit 116665f

Please sign in to comment.