Ayon-Python-Api 0.1.3__tar.gz → 0.1.4__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 (25) hide show
  1. {ayon-python-api-0.1.3/ayon_python_api.egg-info → ayon-python-api-0.1.4}/PKG-INFO +1 -1
  2. ayon-python-api-0.1.4/ayon_api/exceptions.py +93 -0
  3. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/graphql.py +2 -33
  4. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/server.py +3 -39
  5. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/utils.py +2 -16
  6. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/version.py +1 -1
  7. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4/ayon_python_api.egg-info}/PKG-INFO +1 -1
  8. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/pyproject.toml +1 -1
  9. ayon-python-api-0.1.3/ayon_api/exceptions.py +0 -2
  10. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/LICENSE +0 -0
  11. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/README.md +0 -0
  12. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/__init__.py +0 -0
  13. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/constants.py +0 -0
  14. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/entity_hub.py +0 -0
  15. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/events.py +0 -0
  16. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/graphql_queries.py +0 -0
  17. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/operations.py +0 -0
  18. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/server_api.py +0 -0
  19. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_api/thumbnails.py +0 -0
  20. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  21. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  22. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_python_api.egg-info/requires.txt +0 -0
  23. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/ayon_python_api.egg-info/top_level.txt +0 -0
  24. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/setup.cfg +0 -0
  25. {ayon-python-api-0.1.3 → ayon-python-api-0.1.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -0,0 +1,93 @@
1
+ import copy
2
+
3
+
4
+ class UrlError(Exception):
5
+ """Url cannot be parsed as url.
6
+
7
+ Exception may contain hints of possible fixes of url that can be used in
8
+ UI if needed.
9
+ """
10
+
11
+ def __init__(self, message, title, hints=None):
12
+ if hints is None:
13
+ hints = []
14
+
15
+ self.title = title
16
+ self.hints = hints
17
+ super(UrlError, self).__init__(message)
18
+
19
+
20
+ class ServerError(Exception):
21
+ pass
22
+
23
+
24
+ class UnauthorizedError(ServerError):
25
+ pass
26
+
27
+
28
+ class AuthenticationError(ServerError):
29
+ pass
30
+
31
+
32
+ class ServerNotReached(ServerError):
33
+ pass
34
+
35
+
36
+ class GraphQlQueryFailed(Exception):
37
+ def __init__(self, errors, query, variables):
38
+ if variables is None:
39
+ variables = {}
40
+
41
+ error_messages = []
42
+ for error in errors:
43
+ msg = error["message"]
44
+ path = error.get("path")
45
+ if path:
46
+ msg += " on item '{}'".format("/".join(path))
47
+ locations = error.get("locations")
48
+ if locations:
49
+ _locations = [
50
+ "Line {} Column {}".format(
51
+ location["line"], location["column"]
52
+ )
53
+ for location in locations
54
+ ]
55
+
56
+ msg += " ({})".format(" and ".join(_locations))
57
+ error_messages.append(msg)
58
+
59
+ message = "GraphQl query Failed"
60
+ if error_messages:
61
+ message = "{}: {}".format(message, " | ".join(error_messages))
62
+
63
+ self.errors = errors
64
+ self.query = query
65
+ self.variables = copy.deepcopy(variables)
66
+ super(GraphQlQueryFailed, self).__init__(message)
67
+
68
+
69
+ class MissingEntityError(Exception):
70
+ pass
71
+
72
+
73
+ class ProjectNotFound(MissingEntityError):
74
+ def __init__(self, project_name, message=None):
75
+ if not message:
76
+ message = "Project \"{}\" was not found".format(project_name)
77
+ self.project_name = project_name
78
+ super(ProjectNotFound, self).__init__(message)
79
+
80
+
81
+ class FolderNotFound(MissingEntityError):
82
+ def __init__(self, project_name, folder_id, message=None):
83
+ self.project_name = project_name
84
+ self.folder_id = folder_id
85
+ if not message:
86
+ message = (
87
+ "Folder with id \"{}\" was not found in project \"{}\""
88
+ ).format(folder_id, project_name)
89
+ super(FolderNotFound, self).__init__(message)
90
+
91
+
92
+ class FailedOperations(Exception):
93
+ pass
@@ -4,6 +4,8 @@ from abc import ABCMeta, abstractproperty, abstractmethod
4
4
 
5
5
  import six
6
6
 
7
+ from .exceptions import GraphQlQueryFailed
8
+
7
9
  FIELD_VALUE = object()
8
10
 
9
11
 
@@ -29,39 +31,6 @@ def fields_to_dict(fields):
29
31
  return output
30
32
 
31
33
 
32
- class GraphQlQueryFailed(Exception):
33
- def __init__(self, errors, query, variables):
34
- if variables is None:
35
- variables = {}
36
-
37
- error_messages = []
38
- for error in errors:
39
- msg = error["message"]
40
- path = error.get("path")
41
- if path:
42
- msg += " on item '{}'".format("/".join(path))
43
- locations = error.get("locations")
44
- if locations:
45
- _locations = [
46
- "Line {} Column {}".format(
47
- location["line"], location["column"]
48
- )
49
- for location in locations
50
- ]
51
-
52
- msg += " ({})".format(" and ".join(_locations))
53
- error_messages.append(msg)
54
-
55
- message = "GraphQl query Failed"
56
- if error_messages:
57
- message = "{}: {}".format(message, " | ".join(error_messages))
58
-
59
- self.errors = errors
60
- self.query = query
61
- self.variables = copy.deepcopy(variables)
62
- super(GraphQlQueryFailed, self).__init__(message)
63
-
64
-
65
34
  class QueryVariable(object):
66
35
  """Object representing single varible used in GraphQlQuery.
67
36
 
@@ -33,6 +33,9 @@ from .graphql_queries import (
33
33
  )
34
34
  from .exceptions import (
35
35
  FailedOperations,
36
+ UnauthorizedError,
37
+ AuthenticationError,
38
+ ServerNotReached,
36
39
  )
37
40
  from .utils import (
38
41
  logout_from_server,
@@ -49,22 +52,6 @@ PROJECT_NAME_REGEX = re.compile(
49
52
  )
50
53
 
51
54
 
52
- class ServerError(Exception):
53
- pass
54
-
55
-
56
- class UnauthorizedError(ServerError):
57
- pass
58
-
59
-
60
- class AuthenticationError(ServerError):
61
- pass
62
-
63
-
64
- class ServerNotReached(ServerError):
65
- pass
66
-
67
-
68
55
  class RequestType:
69
56
  def __init__(self, name):
70
57
  self.name = name
@@ -81,29 +68,6 @@ class RequestTypes:
81
68
  delete = RequestType("DELETE")
82
69
 
83
70
 
84
- class MissingEntityError(Exception):
85
- pass
86
-
87
-
88
- class ProjectNotFound(MissingEntityError):
89
- def __init__(self, project_name, message=None):
90
- if not message:
91
- message = "Project \"{}\" was not found".format(project_name)
92
- self.project_name = project_name
93
- super(ProjectNotFound, self).__init__(message)
94
-
95
-
96
- class FolderNotFound(MissingEntityError):
97
- def __init__(self, project_name, folder_id, message=None):
98
- self.project_name = project_name
99
- self.folder_id = folder_id
100
- if not message:
101
- message = (
102
- "Folder with id \"{}\" was not found in project \"{}\""
103
- ).format(folder_id, project_name)
104
- super(FolderNotFound, self).__init__(message)
105
-
106
-
107
71
  class RestApiResponse(object):
108
72
  """API Response."""
109
73
 
@@ -7,6 +7,8 @@ except ImportError:
7
7
 
8
8
  import requests
9
9
 
10
+ from .exceptions import UrlError
11
+
10
12
  REMOVED_VALUE = object()
11
13
 
12
14
 
@@ -97,22 +99,6 @@ def prepare_entity_changes(old_entity, new_entity, replace=False):
97
99
  return changes
98
100
 
99
101
 
100
- class UrlError(Exception):
101
- """Url cannot be parsed as url.
102
-
103
- Exception may contain hints of possible fixes of url that can be used in
104
- UI if needed.
105
- """
106
-
107
- def __init__(self, message, title, hints=None):
108
- if hints is None:
109
- hints = []
110
-
111
- self.title = title
112
- self.hints = hints
113
- super(UrlError, self).__init__(message)
114
-
115
-
116
102
  def _try_parse_url(url):
117
103
  try:
118
104
  return urlparse(url)
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.1.3"
2
+ __version__ = "0.1.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.1.3
3
+ Version: 0.1.4
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.1.3"
3
+ version = "0.1.4"
4
4
  description = "Python api for AYON server"
5
5
  authors = ["ynput.io <info@ynput.io>"]
6
6
 
@@ -1,2 +0,0 @@
1
- class FailedOperations(Exception):
2
- pass
File without changes