Ayon-Python-Api 0.3.6__tar.gz → 0.4.1__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.3.6 → ayon-python-api-0.4.1}/PKG-INFO +1 -1
  2. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/constants.py +2 -2
  3. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/server_api.py +30 -5
  4. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/version.py +1 -1
  5. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_python_api.egg-info/PKG-INFO +1 -1
  6. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/pyproject.toml +1 -1
  7. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/LICENSE +0 -0
  8. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/README.md +0 -0
  9. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/__init__.py +0 -0
  10. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/_api.py +0 -0
  11. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/entity_hub.py +0 -0
  12. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/events.py +0 -0
  13. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/exceptions.py +0 -0
  14. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/graphql.py +0 -0
  15. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/graphql_queries.py +0 -0
  16. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_api/utils.py +0 -0
  18. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  19. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  20. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_python_api.egg-info/requires.txt +0 -0
  21. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/ayon_python_api.egg-info/top_level.txt +0 -0
  22. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/setup.cfg +0 -0
  23. {ayon-python-api-0.3.6 → ayon-python-api-0.4.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.3.6
3
+ Version: 0.4.1
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -9,13 +9,13 @@ SERVER_TOKEN_ENV_KEY = SERVER_API_ENV_KEY
9
9
 
10
10
  # --- User ---
11
11
  DEFAULT_USER_FIELDS = {
12
- "roles",
12
+ "accessGroups",
13
+ "defaultAccessGroups",
13
14
  "name",
14
15
  "isService",
15
16
  "isManager",
16
17
  "isGuest",
17
18
  "isAdmin",
18
- "defaultRoles",
19
19
  "createdAt",
20
20
  "active",
21
21
  "hasPassword",
@@ -385,8 +385,12 @@ class ServerAPI(object):
385
385
  )
386
386
  self._sender = sender
387
387
 
388
- self._timeout = timeout
389
- self._max_retries = max_retries
388
+ self._timeout = None
389
+ self._max_retries = None
390
+
391
+ # Set timeout and max retries based on passed values
392
+ self.set_timeout(timeout)
393
+ self.set_max_retries(max_retries)
390
394
 
391
395
  if ssl_verify is None:
392
396
  # Custom AYON env variable for CA file or 'True'
@@ -989,9 +993,17 @@ class ServerAPI(object):
989
993
  for attr, filter_value in filters.items():
990
994
  query.set_variable_value(attr, filter_value)
991
995
 
996
+ # Backwards compatibility for server 0.3.x
997
+ # - will be removed in future releases
998
+ major, minor, _, _, _ = self.server_version_tuple
999
+ access_groups_field = "accessGroups"
1000
+ if major == 0 and minor <= 3:
1001
+ access_groups_field = "roles"
1002
+
992
1003
  for parsed_data in query.continuous_query(self):
993
1004
  for user in parsed_data["users"]:
994
- user["roles"] = json.loads(user["roles"])
1005
+ user[access_groups_field] = json.loads(
1006
+ user[access_groups_field])
995
1007
  yield user
996
1008
 
997
1009
  def get_user(self, username=None):
@@ -1866,7 +1878,15 @@ class ServerAPI(object):
1866
1878
  entity_type_defaults = DEFAULT_WORKFILE_INFO_FIELDS
1867
1879
 
1868
1880
  elif entity_type == "user":
1869
- entity_type_defaults = DEFAULT_USER_FIELDS
1881
+ entity_type_defaults = set(DEFAULT_USER_FIELDS)
1882
+ # Backwards compatibility for server 0.3.x
1883
+ # - will be removed in future releases
1884
+ major, minor, _, _, _ = self.server_version_tuple
1885
+ if major == 0 and minor <= 3:
1886
+ entity_type_defaults.discard("accessGroups")
1887
+ entity_type_defaults.discard("defaultAccessGroups")
1888
+ entity_type_defaults.add("roles")
1889
+ entity_type_defaults.add("defaultRoles")
1870
1890
 
1871
1891
  else:
1872
1892
  raise ValueError("Unknown entity type \"{}\"".format(entity_type))
@@ -2243,7 +2263,12 @@ class ServerAPI(object):
2243
2263
  server.
2244
2264
  """
2245
2265
 
2246
- result = self.get("desktop/dependency_packages")
2266
+ endpoint = "desktop/dependencyPackages"
2267
+ major, minor, _, _, _ = self.server_version_tuple
2268
+ if major == 0 and minor <= 3:
2269
+ endpoint = "desktop/dependency_packages"
2270
+
2271
+ result = self.get(endpoint)
2247
2272
  result.raise_for_status()
2248
2273
  return result.data
2249
2274
 
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.3.6"
2
+ __version__ = "0.4.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.3.6
3
+ Version: 0.4.1
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.3.6"
3
+ version = "0.4.1"
4
4
  description = "AYON Python API"
5
5
  license = {file = "LICENSE"}
6
6
  readme = {file = "README.md", content-type = "text/markdown"}
File without changes