Bases: ContextPlugin
Validate SyncSketch server connection.
Validation is done by trying to connect to the server. syncsketch_id is required to be set on context.data.
Source code in client/ayon_syncsketch/plugins/publish/validate_server_connection.py
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 | class ValidateServerConnection(pyblish.api.ContextPlugin):
"""Validate SyncSketch server connection.
Validation is done by trying to connect to the server.
syncsketch_id is required to be set on context.data.
"""
order = pyblish.api.ValidatorOrder
label = "Validate SyncSketch Connection"
def process(self, context):
self.log.info("Validating SyncSketch connection...")
syncsketch_id = context.data.get("syncsketchProjectId")
server_config = context.data.get("syncsketchServerConfig")
if not syncsketch_id:
raise RuntimeError("SyncSketch ID is not set.")
if not server_config:
raise RuntimeError("SyncSketch server config is not set.")
self.log.info("SyncSketch ID: {}".format(syncsketch_id))
self.log.info("SyncSketch server config: {}".format(server_config))
server_handler = ServerCommunication(
user_auth=server_config.get("auth_user"),
api_key=server_config.get("auth_token"),
host=server_config.get("url")
)
response = server_handler.is_connected()
if not response:
raise requests.exceptions.ConnectionError(
"SyncSketch connection failed.")
|