Ayon-Python-Api 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ayon-python-api-0.1.1 → ayon-python-api-0.1.2}/PKG-INFO +5 -5
- {ayon-python-api-0.1.1 → ayon-python-api-0.1.2}/README.md +1 -1
- ayon-python-api-0.1.2/ayon_api/__init__.py +106 -0
- ayon-python-api-0.1.2/ayon_api/constants.py +90 -0
- ayon-python-api-0.1.2/ayon_api/events.py +105 -0
- ayon-python-api-0.1.2/ayon_api/exceptions.py +2 -0
- ayon-python-api-0.1.2/ayon_api/graphql.py +927 -0
- ayon-python-api-0.1.2/ayon_api/graphql_queries.py +329 -0
- ayon-python-api-0.1.2/ayon_api/operations.py +821 -0
- ayon-python-api-0.1.2/ayon_api/server.py +2321 -0
- ayon-python-api-0.1.2/ayon_api/server_api.py +310 -0
- ayon-python-api-0.1.2/ayon_api/thumbnails.py +219 -0
- ayon-python-api-0.1.2/ayon_api/utils.py +281 -0
- ayon-python-api-0.1.2/ayon_api/version.py +2 -0
- {ayon-python-api-0.1.1/ayon_api → ayon-python-api-0.1.2}/ayon_python_api.egg-info/PKG-INFO +5 -5
- ayon-python-api-0.1.2/ayon_python_api.egg-info/SOURCES.txt +21 -0
- ayon-python-api-0.1.2/ayon_python_api.egg-info/requires.txt +2 -0
- {ayon-python-api-0.1.1 → ayon-python-api-0.1.2}/pyproject.toml +1 -1
- ayon-python-api-0.1.2/setup.py +35 -0
- ayon-python-api-0.1.1/ayon_api/ayon_python_api.egg-info/SOURCES.txt +0 -9
- ayon-python-api-0.1.1/ayon_api/ayon_python_api.egg-info/requires.txt +0 -2
- ayon-python-api-0.1.1/setup.py +0 -40
- {ayon-python-api-0.1.1 → ayon-python-api-0.1.2}/LICENSE +0 -0
- {ayon-python-api-0.1.1/ayon_api → ayon-python-api-0.1.2}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.1.1/ayon_api → ayon-python-api-0.1.2}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.1.1 → ayon-python-api-0.1.2}/setup.cfg +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ayon-python-api
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: AYON Python API
|
|
5
5
|
Home-page: https://github.com/ynput/ayon-python-api
|
|
6
6
|
Author: ynput.io
|
|
7
7
|
Author-email: info@ynput.io
|
|
8
|
-
License:
|
|
9
|
-
Description: #
|
|
8
|
+
License: Apache License (2.0)
|
|
9
|
+
Description: # AYON server API
|
|
10
10
|
Python client for connection server. Client must be (at least for some time) Python 2 compatible because will be used in DCC that are "older".
|
|
11
11
|
|
|
12
12
|
Client should support connection to server with raw REST functions and prepared functionality for work with entities. Must not contain only functionality that can be used with core server functionality.
|
|
@@ -20,7 +20,7 @@ Description: # Ayon server API
|
|
|
20
20
|
- More clear what is difference in `ServerAPIBase` and `ServerAPI`
|
|
21
21
|
- `ServerAPI` was added primarily for desktop app which handle login and logout in a different way so the class should be maybe removed and `ServerAPIBase` should be renamed to `ServerAPI`
|
|
22
22
|
|
|
23
|
-
Keywords:
|
|
23
|
+
Keywords: AYON,ynput,OpenPype,vfx
|
|
24
24
|
Platform: UNKNOWN
|
|
25
25
|
Classifier: Development Status :: 3 - Alpha
|
|
26
26
|
Classifier: Programming Language :: Python
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AYON server API
|
|
2
2
|
Python client for connection server. Client must be (at least for some time) Python 2 compatible because will be used in DCC that are "older".
|
|
3
3
|
|
|
4
4
|
Client should support connection to server with raw REST functions and prepared functionality for work with entities. Must not contain only functionality that can be used with core server functionality.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
from .server import (
|
|
2
|
+
ServerAPIBase,
|
|
3
|
+
)
|
|
4
|
+
|
|
5
|
+
from .server_api import (
|
|
6
|
+
ServerAPI,
|
|
7
|
+
|
|
8
|
+
get_server_api_connection,
|
|
9
|
+
|
|
10
|
+
get,
|
|
11
|
+
post,
|
|
12
|
+
put,
|
|
13
|
+
patch,
|
|
14
|
+
delete,
|
|
15
|
+
|
|
16
|
+
get_projects,
|
|
17
|
+
get_project,
|
|
18
|
+
create_project,
|
|
19
|
+
delete_project,
|
|
20
|
+
|
|
21
|
+
get_folder_by_id,
|
|
22
|
+
get_folder_by_name,
|
|
23
|
+
get_folder_by_path,
|
|
24
|
+
get_folders,
|
|
25
|
+
|
|
26
|
+
get_tasks,
|
|
27
|
+
|
|
28
|
+
get_folder_ids_with_subsets,
|
|
29
|
+
get_subset_by_id,
|
|
30
|
+
get_subset_by_name,
|
|
31
|
+
get_subsets,
|
|
32
|
+
get_subset_families,
|
|
33
|
+
|
|
34
|
+
get_version_by_id,
|
|
35
|
+
get_version_by_name,
|
|
36
|
+
version_is_latest,
|
|
37
|
+
get_versions,
|
|
38
|
+
get_hero_version_by_subset_id,
|
|
39
|
+
get_hero_version_by_id,
|
|
40
|
+
get_hero_versions,
|
|
41
|
+
get_last_versions,
|
|
42
|
+
get_last_version_by_subset_id,
|
|
43
|
+
get_last_version_by_subset_name,
|
|
44
|
+
get_representation_by_id,
|
|
45
|
+
get_representation_by_name,
|
|
46
|
+
get_representations,
|
|
47
|
+
get_representations_parents,
|
|
48
|
+
get_representation_parents,
|
|
49
|
+
|
|
50
|
+
get_project_settings,
|
|
51
|
+
get_addon_settings,
|
|
52
|
+
|
|
53
|
+
create_thumbnail,
|
|
54
|
+
get_thumbnail,
|
|
55
|
+
get_folder_thumbnail,
|
|
56
|
+
get_version_thumbnail,
|
|
57
|
+
get_workfile_thumbnail,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
__all__ = (
|
|
62
|
+
"ServerAPIBase",
|
|
63
|
+
|
|
64
|
+
"ServerAPI",
|
|
65
|
+
"get_server_api_connection",
|
|
66
|
+
"get",
|
|
67
|
+
"post",
|
|
68
|
+
"put",
|
|
69
|
+
"patch",
|
|
70
|
+
"delete",
|
|
71
|
+
|
|
72
|
+
"get_project_settings",
|
|
73
|
+
"get_addon_settings",
|
|
74
|
+
|
|
75
|
+
"get_projects",
|
|
76
|
+
"get_project",
|
|
77
|
+
|
|
78
|
+
"get_folder_by_id",
|
|
79
|
+
"get_folder_by_name",
|
|
80
|
+
"get_folder_by_path",
|
|
81
|
+
"get_folders",
|
|
82
|
+
|
|
83
|
+
"get_tasks",
|
|
84
|
+
|
|
85
|
+
"get_folder_ids_with_subsets",
|
|
86
|
+
"get_subset_by_id",
|
|
87
|
+
"get_subset_by_name",
|
|
88
|
+
"get_subsets",
|
|
89
|
+
"get_subset_families",
|
|
90
|
+
"get_version_by_id",
|
|
91
|
+
"get_version_by_name",
|
|
92
|
+
"version_is_latest",
|
|
93
|
+
"get_versions",
|
|
94
|
+
"get_hero_version_by_subset_id",
|
|
95
|
+
"get_hero_version_by_id",
|
|
96
|
+
"get_hero_versions",
|
|
97
|
+
"get_last_versions",
|
|
98
|
+
"get_last_version_by_subset_id",
|
|
99
|
+
"get_last_version_by_subset_name",
|
|
100
|
+
"get_representation_by_id",
|
|
101
|
+
"get_representation_by_name",
|
|
102
|
+
"get_representations",
|
|
103
|
+
"get_representations_parents",
|
|
104
|
+
"get_representation_parents",
|
|
105
|
+
"get_thumbnail_id_from_source",
|
|
106
|
+
)
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
SERVER_URL_ENV_KEY = "AYON_SERVER_URL"
|
|
2
|
+
SERVER_TOKEN_ENV_KEY = "AYON_TOKEN"
|
|
3
|
+
|
|
4
|
+
# --- Project ---
|
|
5
|
+
DEFAULT_PROJECT_FIELDS = {
|
|
6
|
+
"active",
|
|
7
|
+
"name",
|
|
8
|
+
"code",
|
|
9
|
+
"config",
|
|
10
|
+
"createdAt",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# --- Folders ---
|
|
14
|
+
DEFAULT_FOLDER_FIELDS = {
|
|
15
|
+
"id",
|
|
16
|
+
"name",
|
|
17
|
+
"label",
|
|
18
|
+
"folderType",
|
|
19
|
+
"path",
|
|
20
|
+
"parentId",
|
|
21
|
+
"active",
|
|
22
|
+
"thumbnailId",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
# --- Tasks ---
|
|
26
|
+
DEFAULT_TASK_FIELDS = {
|
|
27
|
+
"id",
|
|
28
|
+
"name",
|
|
29
|
+
"label",
|
|
30
|
+
"taskType",
|
|
31
|
+
"folderId",
|
|
32
|
+
"active",
|
|
33
|
+
"assignees",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# --- Subsets ---
|
|
37
|
+
DEFAULT_SUBSET_FIELDS = {
|
|
38
|
+
"id",
|
|
39
|
+
"name",
|
|
40
|
+
"folderId",
|
|
41
|
+
"active",
|
|
42
|
+
"family",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# --- Versions ---
|
|
46
|
+
DEFAULT_VERSION_FIELDS = {
|
|
47
|
+
"id",
|
|
48
|
+
"name",
|
|
49
|
+
"version",
|
|
50
|
+
"subsetId",
|
|
51
|
+
"taskId",
|
|
52
|
+
"active",
|
|
53
|
+
"author",
|
|
54
|
+
"thumbnailId",
|
|
55
|
+
"createdAt",
|
|
56
|
+
"updatedAt",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# --- Representations ---
|
|
60
|
+
DEFAULT_REPRESENTATION_FIELDS = {
|
|
61
|
+
"id",
|
|
62
|
+
"name",
|
|
63
|
+
"context",
|
|
64
|
+
"createdAt",
|
|
65
|
+
"active",
|
|
66
|
+
"versionId",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
REPRESENTATION_FILES_FIELDS = {
|
|
70
|
+
"files.baseName",
|
|
71
|
+
"files.hash",
|
|
72
|
+
"files.id",
|
|
73
|
+
"files.path",
|
|
74
|
+
"files.size",
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# --- Workfile info ---
|
|
78
|
+
DEFAULT_WORKFILE_INFO_FIELDS = {
|
|
79
|
+
"active",
|
|
80
|
+
"createdAt",
|
|
81
|
+
"createdBy",
|
|
82
|
+
"id",
|
|
83
|
+
"name",
|
|
84
|
+
"path",
|
|
85
|
+
"projectName",
|
|
86
|
+
"taskId",
|
|
87
|
+
"thumbnailId",
|
|
88
|
+
"updatedAt",
|
|
89
|
+
"updatedBy",
|
|
90
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
|
|
3
|
+
from .server import get_server_api_connection
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ServerEvent(object):
|
|
7
|
+
def __init__(
|
|
8
|
+
self,
|
|
9
|
+
topic,
|
|
10
|
+
sender=None,
|
|
11
|
+
hash=None,
|
|
12
|
+
project_name=None,
|
|
13
|
+
username=None,
|
|
14
|
+
dependencies=None,
|
|
15
|
+
description=None,
|
|
16
|
+
summary=None,
|
|
17
|
+
payload=None,
|
|
18
|
+
finished=True,
|
|
19
|
+
store=True,
|
|
20
|
+
):
|
|
21
|
+
if dependencies is None:
|
|
22
|
+
dependencies = []
|
|
23
|
+
if payload is None:
|
|
24
|
+
payload = {}
|
|
25
|
+
if summary is None:
|
|
26
|
+
summary = {}
|
|
27
|
+
|
|
28
|
+
self.topic = topic
|
|
29
|
+
self.sender = sender
|
|
30
|
+
self.hash = hash
|
|
31
|
+
self.project_name = project_name
|
|
32
|
+
self.username = username
|
|
33
|
+
self.dependencies = dependencies
|
|
34
|
+
self.summary = summary
|
|
35
|
+
self.payload = payload
|
|
36
|
+
self.finished = finished
|
|
37
|
+
self.store = store
|
|
38
|
+
|
|
39
|
+
def to_data(self):
|
|
40
|
+
return {
|
|
41
|
+
"topic": self.topic,
|
|
42
|
+
"sender": self.sender,
|
|
43
|
+
"hash": self.hash,
|
|
44
|
+
"project": self.project_name,
|
|
45
|
+
"user": self.username,
|
|
46
|
+
"dependencies": copy.deepcopy(self.dependencies),
|
|
47
|
+
"description": self.description,
|
|
48
|
+
"summary": copy.deepcopy(self.summary),
|
|
49
|
+
"payload": self.payload,
|
|
50
|
+
"finished": self.finished,
|
|
51
|
+
"store": self.store
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def dispatch_event(
|
|
56
|
+
topic,
|
|
57
|
+
sender=None,
|
|
58
|
+
hash=None,
|
|
59
|
+
project_name=None,
|
|
60
|
+
username=None,
|
|
61
|
+
dependencies=None,
|
|
62
|
+
description=None,
|
|
63
|
+
summary=None,
|
|
64
|
+
payload=None,
|
|
65
|
+
finished=True,
|
|
66
|
+
store=True,
|
|
67
|
+
):
|
|
68
|
+
"""Dispatch event to server.
|
|
69
|
+
|
|
70
|
+
Arg:
|
|
71
|
+
topic (str): Event topic used for filtering of listeners.
|
|
72
|
+
sender (Optional[str]): Sender of event.
|
|
73
|
+
hash (Optional[str]): Event hash.
|
|
74
|
+
project_name (Optional[str]): Project name.
|
|
75
|
+
username (Optional[str]): Username which triggered event.
|
|
76
|
+
dependencies (Optional[list[str]]): List of event id deprendencies.
|
|
77
|
+
description (Optional[str]): Description of event.
|
|
78
|
+
summary (Optional[dict[str, Any]]): Summary of event that can be used
|
|
79
|
+
for simple filtering on listeners.
|
|
80
|
+
payload (Optional[dict[str, Any]]): Full payload of event data with
|
|
81
|
+
all details.
|
|
82
|
+
finished (bool): Mark event as finished on dispatch.
|
|
83
|
+
store (bool): Store event in event queue for possible future processing
|
|
84
|
+
otherwise is event send only to active listeners.
|
|
85
|
+
"""
|
|
86
|
+
|
|
87
|
+
event = ServerEvent(
|
|
88
|
+
topic,
|
|
89
|
+
sender,
|
|
90
|
+
hash,
|
|
91
|
+
project_name,
|
|
92
|
+
username,
|
|
93
|
+
dependencies,
|
|
94
|
+
description,
|
|
95
|
+
summary,
|
|
96
|
+
payload,
|
|
97
|
+
finished,
|
|
98
|
+
store
|
|
99
|
+
)
|
|
100
|
+
con = get_server_api_connection()
|
|
101
|
+
response = con.post("events", json=event.to_data())
|
|
102
|
+
if response:
|
|
103
|
+
print(response, response.data)
|
|
104
|
+
return event
|
|
105
|
+
return None
|