Ayon-Python-Api 0.3.0__tar.gz → 0.3.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 (24) hide show
  1. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/PKG-INFO +1 -1
  2. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/server_api.py +42 -36
  3. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/version.py +1 -1
  4. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_python_api.egg-info/PKG-INFO +1 -1
  5. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/pyproject.toml +1 -1
  6. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/LICENSE +0 -0
  7. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/README.md +0 -0
  8. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/__init__.py +0 -0
  9. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/_api.py +0 -0
  10. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/constants.py +0 -0
  11. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/entity_hub.py +0 -0
  12. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/events.py +0 -0
  13. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/exceptions.py +0 -0
  14. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/graphql.py +0 -0
  15. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/graphql_queries.py +0 -0
  16. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/thumbnails.py +0 -0
  18. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_api/utils.py +0 -0
  19. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  20. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  21. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_python_api.egg-info/requires.txt +0 -0
  22. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/ayon_python_api.egg-info/top_level.txt +0 -0
  23. {ayon-python-api-0.3.0 → ayon-python-api-0.3.1}/setup.cfg +0 -0
  24. {ayon-python-api-0.3.0 → ayon-python-api-0.3.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.0
3
+ Version: 0.3.1
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -1964,6 +1964,24 @@ class ServerAPI(object):
1964
1964
  result.raise_for_status()
1965
1965
  return result.data
1966
1966
 
1967
+ def _get_dependency_package_route(
1968
+ self, filename=None, platform_name=None
1969
+ ):
1970
+ major, minor, patch, _, _ = self.server_version_tuple
1971
+ if major == 0 and (minor > 2 or (minor == 2 and patch >= 1)):
1972
+ base = "desktop/dependency_packages"
1973
+ if not filename:
1974
+ return base
1975
+ return "{}/{}".format(base, filename)
1976
+
1977
+ # Backwards compatibility for AYON server 0.2.0 and lower
1978
+ if platform_name is None:
1979
+ platform_name = platform.system().lower()
1980
+ base = "dependencies"
1981
+ if not filename:
1982
+ return base
1983
+ return "{}/{}/{}".format(base, filename, platform_name)
1984
+
1967
1985
  def create_dependency_package(
1968
1986
  self,
1969
1987
  filename,
@@ -2014,7 +2032,8 @@ class ServerAPI(object):
2014
2032
  if sources:
2015
2033
  post_body["sources"] = sources
2016
2034
 
2017
- response = self.post("desktop/dependency_packages", **post_body)
2035
+ route = self._get_dependency_package_route()
2036
+ response = self.post(route, **post_body)
2018
2037
  response.raise_for_status()
2019
2038
 
2020
2039
  def update_dependency_package(self, filename, sources):
@@ -2028,7 +2047,7 @@ class ServerAPI(object):
2028
2047
  """
2029
2048
 
2030
2049
  response = self.patch(
2031
- "desktop/dependency_packages/{}".format(filename),
2050
+ self._get_dependency_package_route(filename),
2032
2051
  sources=sources
2033
2052
  )
2034
2053
  response.raise_for_status()
@@ -2044,16 +2063,8 @@ class ServerAPI(object):
2044
2063
  Deprecated since version 0.2.1
2045
2064
  """
2046
2065
 
2047
- major, minor, patch, _, _ = self.server_version_tuple
2048
- if major == 0 and (minor > 2 or (minor == 2 and patch >= 1)):
2049
- url = "desktop/dependency_packages/{}".format(filename)
2050
- else:
2051
- # Backwards compatibility for AYON server 0.2.0 and lower
2052
- if platform_name is None:
2053
- platform_name = platform.system().lower()
2054
- url = "dependencies/{}/{}".format(filename, platform_name)
2055
-
2056
- response = self.delete(url)
2066
+ route = self._get_dependency_package_route(filename, platform_name)
2067
+ response = self.delete(route)
2057
2068
  if response.status != 200:
2058
2069
  raise ServerError("Failed to delete dependency file")
2059
2070
  return response.data
@@ -2089,18 +2100,10 @@ class ServerAPI(object):
2089
2100
  str: Filepath to downloaded file.
2090
2101
  """
2091
2102
 
2092
- major, minor, patch, _, _ = self.server_version_tuple
2093
- if major == 0 and (minor > 2 or (minor == 2 and patch >= 1)):
2094
- url = "desktop/dependency_packages/{}".format(src_filename)
2095
- else:
2096
- # Backwards compatibility for AYON server 0.2.0 and lower
2097
- if platform_name is None:
2098
- platform_name = platform.system().lower()
2099
- url = "dependencies/{}/{}".format(src_filename, platform_name)
2100
-
2103
+ route = self._get_dependency_package_route(src_filename, platform_name)
2101
2104
  package_filepath = os.path.join(dst_directory, dst_filename)
2102
2105
  self.download_file(
2103
- url,
2106
+ route,
2104
2107
  package_filepath,
2105
2108
  chunk_size=chunk_size,
2106
2109
  progress=progress
@@ -2122,16 +2125,8 @@ class ServerAPI(object):
2122
2125
  upload state.
2123
2126
  """
2124
2127
 
2125
- major, minor, patch, _, _ = self.server_version_tuple
2126
- if major == 0 and (minor > 2 or (minor == 2 and patch >= 1)):
2127
- url = "desktop/dependency_packages/{}".format(dst_filename)
2128
- else:
2129
- # Backwards compatibility for AYON server 0.2.0 and lower
2130
- if platform_name is None:
2131
- platform_name = platform.system().lower()
2132
- url = "dependencies/{}/{}".format(dst_filename, platform_name)
2133
-
2134
- self.upload_file(url, src_filepath, progress=progress)
2128
+ route = self._get_dependency_package_route(dst_filename, platform_name)
2129
+ self.upload_file(route, src_filepath, progress=progress)
2135
2130
 
2136
2131
  def create_dependency_package_basename(self, platform_name=None):
2137
2132
  """Create basename for dependency package file.
@@ -2151,6 +2146,14 @@ class ServerAPI(object):
2151
2146
  time_stamp = now_date.strftime("%y%m%d%H%M")
2152
2147
  return "ayon_{}_{}".format(time_stamp, platform_name)
2153
2148
 
2149
+ def _get_bundles_route(self):
2150
+ major, minor, patch, _, _ = self.server_version_tuple
2151
+ # Backwards compatibility for AYON server 0.3.0
2152
+ # - first version where bundles were available
2153
+ if major == 0 and minor == 3 and patch == 0:
2154
+ return "desktop/bundles"
2155
+ return "bundles"
2156
+
2154
2157
  def get_bundles(self):
2155
2158
  """Server bundles with basic information.
2156
2159
 
@@ -2181,7 +2184,7 @@ class ServerAPI(object):
2181
2184
  dict[str, Any]: Server bundles with basic information.
2182
2185
  """
2183
2186
 
2184
- response = self.get("desktop/bundles")
2187
+ response = self.get(self._get_bundles_route())
2185
2188
  response.raise_for_status()
2186
2189
  return response.data
2187
2190
 
@@ -2224,7 +2227,7 @@ class ServerAPI(object):
2224
2227
  if value is not None:
2225
2228
  body[key] = value
2226
2229
 
2227
- response = self.post("desktop/bundles", **body)
2230
+ response = self.post(self._get_bundles_route(), **body)
2228
2231
  response.raise_for_status()
2229
2232
 
2230
2233
  def update_bundle(
@@ -2259,7 +2262,8 @@ class ServerAPI(object):
2259
2262
  if value is not None
2260
2263
  }
2261
2264
  response = self.patch(
2262
- "desktop/bundles/{}".format(bundle_name), **body
2265
+ "{}/{}".format(self._get_bundles_route(), bundle_name),
2266
+ **body
2263
2267
  )
2264
2268
  response.raise_for_status()
2265
2269
 
@@ -2270,7 +2274,9 @@ class ServerAPI(object):
2270
2274
  bundle_name (str): Name of bundle to delete.
2271
2275
  """
2272
2276
 
2273
- response = self.delete("desktop/bundles/{}".format(bundle_name))
2277
+ response = self.delete(
2278
+ "{}/{}".format(self._get_bundles_route(), bundle_name)
2279
+ )
2274
2280
  response.raise_for_status()
2275
2281
 
2276
2282
  # Anatomy presets
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.3.0"
2
+ __version__ = "0.3.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.3.0
3
+ Version: 0.3.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.0"
3
+ version = "0.3.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