Ayon-Python-Api 0.5.1__tar.gz → 0.5.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.
Files changed (23) hide show
  1. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/PKG-INFO +1 -1
  2. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/entity_hub.py +23 -2
  3. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/server_api.py +7 -1
  4. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/version.py +1 -1
  5. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_python_api.egg-info/PKG-INFO +1 -1
  6. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/pyproject.toml +1 -1
  7. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/LICENSE +0 -0
  8. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/README.md +0 -0
  9. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/__init__.py +0 -0
  10. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/_api.py +0 -0
  11. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/constants.py +0 -0
  12. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/events.py +0 -0
  13. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/exceptions.py +0 -0
  14. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/graphql.py +0 -0
  15. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/graphql_queries.py +0 -0
  16. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_api/utils.py +0 -0
  18. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  19. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  20. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_python_api.egg-info/requires.txt +0 -0
  21. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/ayon_python_api.egg-info/top_level.txt +0 -0
  22. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/setup.cfg +0 -0
  23. {ayon-python-api-0.5.1 → ayon-python-api-0.5.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -40,7 +40,13 @@ class EntityHub(object):
40
40
  ):
41
41
  if not connection:
42
42
  connection = get_server_api_connection()
43
+ major, minor, _, _, _ = connection.server_version_tuple
44
+ path_start_with_slash = True
45
+ if (major, minor) < (0, 6):
46
+ path_start_with_slash = False
47
+
43
48
  self._connection = connection
49
+ self._path_start_with_slash = path_start_with_slash
44
50
 
45
51
  self._project_name = project_name
46
52
  self._entities_by_id = {}
@@ -65,6 +71,18 @@ class EntityHub(object):
65
71
 
66
72
  return self._allow_data_changes
67
73
 
74
+ @property
75
+ def path_start_with_slash(self):
76
+ """Folder path should start with slash.
77
+
78
+ This changed in 0.6.x server version.
79
+
80
+ Returns:
81
+ bool: Path starts with slash.
82
+ """
83
+
84
+ return self._path_start_with_slash
85
+
68
86
  @property
69
87
  def project_name(self):
70
88
  """Project name which is maintained by hub.
@@ -2419,10 +2437,13 @@ class FolderEntity(BaseEntity):
2419
2437
 
2420
2438
  if self._path is None:
2421
2439
  parent = self.parent
2422
- path = self.name
2423
2440
  if parent.entity_type == "folder":
2424
2441
  parent_path = parent.path
2425
- path = "/".join([parent_path, path])
2442
+ path = "/".join([parent_path, self.name])
2443
+ elif self._entity_hub.path_start_with_slash:
2444
+ path = "/{}".format(self.name)
2445
+ else:
2446
+ path = self.name
2426
2447
  self._path = path
2427
2448
  return self._path
2428
2449
 
@@ -176,6 +176,11 @@ class RestApiResponse(object):
176
176
  return self.status
177
177
 
178
178
  def raise_for_status(self, message=None):
179
+ if self._response is None:
180
+ if self._data and self._data.get("detail"):
181
+ raise ServerError(self._data["detail"])
182
+ raise ValueError("Response is not available.")
183
+
179
184
  try:
180
185
  self._response.raise_for_status()
181
186
  except requests.exceptions.HTTPError as exc:
@@ -1512,8 +1517,9 @@ class ServerAPI(object):
1512
1517
  "sourceTopic": source_topic,
1513
1518
  "targetTopic": target_topic,
1514
1519
  "sender": sender,
1515
- "maxRetries": max_retries,
1516
1520
  }
1521
+ if max_retries is not None:
1522
+ kwargs["maxRetries"] = max_retries
1517
1523
  if sequential is not None:
1518
1524
  kwargs["sequential"] = sequential
1519
1525
  if description is not None:
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.5.1"
2
+ __version__ = "0.5.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ayon-python-api"
3
- version = "0.5.1"
3
+ version = "0.5.2"
4
4
  description = "AYON Python API"
5
5
  license = {file = "LICENSE"}
6
6
  readme = {file = "README.md", content-type = "text/markdown"}
File without changes