Ayon-Python-Api 0.2.1__tar.gz → 0.2.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 (24) hide show
  1. {ayon-python-api-0.2.1/ayon_python_api.egg-info → ayon-python-api-0.2.2}/PKG-INFO +1 -1
  2. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/__init__.py +1 -0
  3. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/_api.py +5 -0
  4. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/server_api.py +76 -2
  5. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/version.py +1 -1
  6. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2/ayon_python_api.egg-info}/PKG-INFO +1 -1
  7. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/pyproject.toml +1 -1
  8. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/LICENSE +0 -0
  9. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/README.md +0 -0
  10. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/constants.py +0 -0
  11. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/entity_hub.py +0 -0
  12. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/events.py +0 -0
  13. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/exceptions.py +0 -0
  14. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/graphql.py +0 -0
  15. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/graphql_queries.py +0 -0
  16. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/thumbnails.py +0 -0
  18. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_api/utils.py +0 -0
  19. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  20. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  21. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/requires.txt +0 -0
  22. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/ayon_python_api.egg-info/top_level.txt +0 -0
  23. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/setup.cfg +0 -0
  24. {ayon-python-api-0.2.1 → ayon-python-api-0.2.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -116,6 +116,7 @@ from ._api import (
116
116
  get_folder_by_name,
117
117
  get_folder_by_path,
118
118
  get_folders,
119
+ get_folders_hierarchy,
119
120
 
120
121
  get_tasks,
121
122
 
@@ -723,6 +723,11 @@ def get_folders(*args, **kwargs):
723
723
  return con.get_folders(*args, **kwargs)
724
724
 
725
725
 
726
+ def get_folders_hierarchy(*args, **kwargs):
727
+ con = get_server_api_connection()
728
+ return con.get_folders_hierarchy(*args, **kwargs)
729
+
730
+
726
731
  def get_tasks(*args, **kwargs):
727
732
  con = get_server_api_connection()
728
733
  return con.get_tasks(*args, **kwargs)
@@ -313,6 +313,11 @@ class ServerAPI(object):
313
313
  default_settings_variant (Optional[str]): Settings variant used by
314
314
  default if a method for settings won't get any (by default is
315
315
  'production').
316
+ ssl_verify (Union[bool, str, None]): Verify SSL certificate
317
+ Looks for env variable value 'AYON_CA_FILE' by default. If not
318
+ available then 'True' is used.
319
+ cert (Optional[str]): Path to certificate file. Looks for env
320
+ variable value 'AYON_CERT_FILE' by default.
316
321
  """
317
322
 
318
323
  def __init__(
@@ -321,7 +326,9 @@ class ServerAPI(object):
321
326
  token=None,
322
327
  site_id=None,
323
328
  client_version=None,
324
- default_settings_variant=None
329
+ default_settings_variant=None,
330
+ ssl_verify=None,
331
+ cert=None,
325
332
  ):
326
333
  if not base_url:
327
334
  raise ValueError("Invalid server URL {}".format(str(base_url)))
@@ -335,6 +342,19 @@ class ServerAPI(object):
335
342
  self._site_id = site_id
336
343
  self._client_version = client_version
337
344
  self._default_settings_variant = default_settings_variant
345
+
346
+ if ssl_verify is None:
347
+ # Custom AYON env variable for CA file or 'True'
348
+ # - that should cover most default behaviors in 'requests'
349
+ # with 'certifi'
350
+ ssl_verify = os.environ.get("AYON_CA_FILE") or True
351
+
352
+ if cert is None:
353
+ cert = os.environ.get("AYON_CERT_FILE")
354
+
355
+ self._ssl_verify = ssl_verify
356
+ self._cert = cert
357
+
338
358
  self._access_token_is_service = None
339
359
  self._token_is_valid = None
340
360
  self._server_available = None
@@ -374,6 +394,54 @@ class ServerAPI(object):
374
394
  base_url = property(get_base_url)
375
395
  rest_url = property(get_rest_url)
376
396
 
397
+ def get_ssl_verify(self):
398
+ """Enable ssl verification.
399
+
400
+ Returns:
401
+ bool: Current state of ssl verification.
402
+ """
403
+
404
+ return self._ssl_verify
405
+
406
+ def set_ssl_verify(self, ssl_verify):
407
+ """Change ssl verification state.
408
+
409
+ Args:
410
+ ssl_verify (Union[bool, str, None]): Enabled/disable
411
+ ssl verification, can be a path to file.
412
+ """
413
+
414
+ if self._ssl_verify == ssl_verify:
415
+ return
416
+ self._ssl_verify = ssl_verify
417
+ if self._session is not None:
418
+ self._session.verify = ssl_verify
419
+
420
+ def get_cert(self):
421
+ """Current cert file used for connection to server.
422
+
423
+ Returns:
424
+ Union[str, None]: Path to cert file.
425
+ """
426
+
427
+ return self._cert
428
+
429
+ def set_cert(self, cert):
430
+ """Change cert file used for connection to server.
431
+
432
+ Args:
433
+ cert (Union[str, None]): Path to cert file.
434
+ """
435
+
436
+ if cert == self._cert:
437
+ return
438
+ self._cert = cert
439
+ if self._session is not None:
440
+ self._session.cert = cert
441
+
442
+ ssl_verify = property(get_ssl_verify, set_ssl_verify)
443
+ cert = property(get_cert, set_cert)
444
+
377
445
  @property
378
446
  def access_token(self):
379
447
  """Access token used for authorization to server.
@@ -545,7 +613,11 @@ class ServerAPI(object):
545
613
  @property
546
614
  def is_server_available(self):
547
615
  if self._server_available is None:
548
- response = requests.get(self._base_url)
616
+ response = requests.get(
617
+ self._base_url,
618
+ cert=self._cert,
619
+ verify=self._ssl_verify
620
+ )
549
621
  self._server_available = response.status_code == 200
550
622
  return self._server_available
551
623
 
@@ -596,6 +668,8 @@ class ServerAPI(object):
596
668
  self.validate_token()
597
669
 
598
670
  session = requests.Session()
671
+ session.cert = self._cert
672
+ session.verify = self._ssl_verify
599
673
  session.headers.update(self.get_headers())
600
674
 
601
675
  self._session_functions_mapping = {
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.2.1"
2
+ __version__ = "0.2.2"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.2.1
3
+ Version: 0.2.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
  [tool.poetry]
2
2
  name = "ayon_api"
3
- version = "0.2.1"
3
+ version = "0.2.2"
4
4
  description = "Python api for AYON server"
5
5
  authors = ["ynput.io <info@ynput.io>"]
6
6
 
File without changes