dnastack-client-library 3.1.160__py3-none-any.whl → 3.1.162__py3-none-any.whl
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.
- dnastack/client/explorer/client.py +8 -13
- dnastack/constants.py +1 -1
- dnastack/http/session.py +15 -6
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/METADATA +1 -1
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/RECORD +9 -9
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/WHEEL +0 -0
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/entry_points.txt +0 -0
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/licenses/LICENSE +0 -0
- {dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/top_level.txt +0 -0
|
@@ -91,11 +91,9 @@ class ExplorerClient(BaseServiceClient):
|
|
|
91
91
|
f"Not authorized to access question '{question_id}'"
|
|
92
92
|
)
|
|
93
93
|
elif status_code == 404:
|
|
94
|
-
raise ClientError(f"Question '{question_id}' not found")
|
|
94
|
+
raise ClientError(e.response, e.trace, f"Question '{question_id}' not found")
|
|
95
95
|
else:
|
|
96
|
-
raise ClientError(
|
|
97
|
-
f"Failed to retrieve question '{question_id}': {e.response.text}"
|
|
98
|
-
)
|
|
96
|
+
raise ClientError(e.response, e.trace, f"Failed to retrieve question '{question_id}'")
|
|
99
97
|
|
|
100
98
|
def ask_federated_question(
|
|
101
99
|
self,
|
|
@@ -179,9 +177,8 @@ class FederatedQuestionListResultLoader(ResultLoader):
|
|
|
179
177
|
"Not authorized to list federated questions"
|
|
180
178
|
)
|
|
181
179
|
else:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
180
|
+
|
|
181
|
+
raise ClientError(e.response, e.trace, "Failed to load federated questions")
|
|
185
182
|
|
|
186
183
|
|
|
187
184
|
class FederatedQuestionQueryResultLoader(ResultLoader):
|
|
@@ -247,10 +244,8 @@ class FederatedQuestionQueryResultLoader(ResultLoader):
|
|
|
247
244
|
"Not authorized to ask federated questions"
|
|
248
245
|
)
|
|
249
246
|
elif status_code == 400:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
247
|
+
|
|
248
|
+
raise ClientError(e.response, e.trace, "Invalid question parameters")
|
|
253
249
|
else:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
)
|
|
250
|
+
|
|
251
|
+
raise ClientError(e.response, e.trace, "Failed to execute federated question")
|
dnastack/constants.py
CHANGED
dnastack/http/session.py
CHANGED
|
@@ -23,8 +23,8 @@ class AuthenticationError(RuntimeError):
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class HttpError(RuntimeError):
|
|
26
|
-
def __init__(self, response: Response, trace_context: Optional[Span] = None):
|
|
27
|
-
super(HttpError, self).__init__(response, trace_context)
|
|
26
|
+
def __init__(self, response: Response, trace_context: Optional[Span] = None, message: Optional[str] = None):
|
|
27
|
+
super(HttpError, self).__init__(response, trace_context, message)
|
|
28
28
|
|
|
29
29
|
@property
|
|
30
30
|
def response(self) -> Response:
|
|
@@ -33,19 +33,26 @@ class HttpError(RuntimeError):
|
|
|
33
33
|
@property
|
|
34
34
|
def trace(self) -> Span:
|
|
35
35
|
return self.args[1]
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def message(self) -> Optional[str]:
|
|
39
|
+
return self.args[2] if len(self.args) > 2 else None
|
|
36
40
|
|
|
37
41
|
def __str__(self):
|
|
38
42
|
response: Response = self.response
|
|
39
43
|
|
|
40
44
|
error_feedback = f'HTTP {response.status_code}'
|
|
41
45
|
|
|
42
|
-
# Prepare the error feedback.
|
|
43
46
|
response_text = response.text.strip()
|
|
44
47
|
if len(response_text) == 0:
|
|
45
48
|
error_feedback = f'{error_feedback} (empty response)'
|
|
46
49
|
else:
|
|
47
50
|
error_feedback = f'{error_feedback}: {response_text}'
|
|
48
51
|
|
|
52
|
+
custom_message = self.message
|
|
53
|
+
if custom_message:
|
|
54
|
+
error_feedback = f'{custom_message} - {error_feedback}'
|
|
55
|
+
|
|
49
56
|
trace: Span = self.trace
|
|
50
57
|
if trace:
|
|
51
58
|
error_feedback = f'[{trace.trace_id},{trace.span_id}] {error_feedback}'
|
|
@@ -68,6 +75,7 @@ class JsonPatch(BaseModel):
|
|
|
68
75
|
|
|
69
76
|
|
|
70
77
|
class RetryHistoryEntry(BaseModel):
|
|
78
|
+
url: str
|
|
71
79
|
authenticator_index: int
|
|
72
80
|
with_reauthentication: bool
|
|
73
81
|
with_next_authenticator: bool
|
|
@@ -153,7 +161,7 @@ class HttpSession(AbstractContextManager):
|
|
|
153
161
|
authenticator_index: int = 0,
|
|
154
162
|
retry_history: Optional[List[RetryHistoryEntry]] = None,
|
|
155
163
|
trace_context: Optional[Span] = None,
|
|
156
|
-
**kwargs) -> Response:
|
|
164
|
+
**kwargs) -> Response | None | Any:
|
|
157
165
|
trace_context = trace_context or Span(origin=self)
|
|
158
166
|
|
|
159
167
|
retry_history = retry_history or list()
|
|
@@ -317,7 +325,8 @@ class HttpSession(AbstractContextManager):
|
|
|
317
325
|
def _raise_http_error(self,
|
|
318
326
|
response: Response,
|
|
319
327
|
authenticator: Authenticator,
|
|
320
|
-
trace_context: Span
|
|
328
|
+
trace_context: Span,
|
|
329
|
+
message: Optional[str] = None):
|
|
321
330
|
trace_logger = trace_context.create_span_logger(self.__logger) if trace_context else self.__logger
|
|
322
331
|
|
|
323
332
|
if isinstance(authenticator, OAuth2Authenticator):
|
|
@@ -344,7 +353,7 @@ class HttpSession(AbstractContextManager):
|
|
|
344
353
|
else:
|
|
345
354
|
trace_logger.error('The authenticator is not available or supported for extracting additional info.')
|
|
346
355
|
|
|
347
|
-
raise (ClientError if response.status_code < 500 else ServerError)(response, trace_context=trace_context)
|
|
356
|
+
raise (ClientError if response.status_code < 500 else ServerError)(response, trace_context=trace_context, message=message)
|
|
348
357
|
|
|
349
358
|
def __del__(self):
|
|
350
359
|
self.close()
|
{dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
dnastack/__init__.py,sha256=mslf7se8vBSK_HkqWTGPdibeVhT4xyKXgzQBV7dEK1M,333
|
|
2
2
|
dnastack/__main__.py,sha256=EKmtIs4TBseQJi-OT_U6LqRyKLiyrGTBuTQg9zE-G2I,4376
|
|
3
|
-
dnastack/constants.py,sha256=
|
|
3
|
+
dnastack/constants.py,sha256=6P579Aw9VUw8nJ_eFzwu-eQjSXMo09xI9vmHC62W9wM,114
|
|
4
4
|
dnastack/feature_flags.py,sha256=RK_V_Ovncoe6NeTheAA_frP-kYkZC1fDlTbbup2KYG4,1419
|
|
5
5
|
dnastack/json_path.py,sha256=TyghhDf7nGQmnsUWBhenU_fKsE_Ez-HLVER6HgH5-hU,2700
|
|
6
6
|
dnastack/omics_cli.py,sha256=ZppKZTHv_XjUUZyRIzSkx0Ug5ODAYrCOTsU0ezCOVrA,3694
|
|
@@ -125,7 +125,7 @@ dnastack/client/datasources/__init__.py,sha256=HxDIHuQX8KMWr3o70ucL3x79pXKaIHbBq
|
|
|
125
125
|
dnastack/client/datasources/client.py,sha256=jfVzCSKuQJsggbvfJVbftYJ0hd6gAPsBZMgvINOgjRE,4671
|
|
126
126
|
dnastack/client/datasources/model.py,sha256=dV9Sf05ivIq0ubwIIYK3kSv1xJ_TtjxvVp_ddI9aHEk,214
|
|
127
127
|
dnastack/client/explorer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
|
-
dnastack/client/explorer/client.py,sha256=
|
|
128
|
+
dnastack/client/explorer/client.py,sha256=_YisPn9jQUSk-O-8E9Vncn_jALLRvu7etYC-1KK3vKY,9416
|
|
129
129
|
dnastack/client/explorer/models.py,sha256=vrltbcb4qAx6z1oGXG8ufw2kZ36dDiwU5QGqOomYp6c,3126
|
|
130
130
|
dnastack/client/service_registry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
131
131
|
dnastack/client/service_registry/client.py,sha256=r7D8CnPJLbNkc03g2PYHt880Ba1oPW2d8B0ShP0p4Eo,1131
|
|
@@ -179,7 +179,7 @@ dnastack/context/manager.py,sha256=4Z_KhDhIClkUOiT605yi9SwehdqiJwYth4T3G3Lb4rM,1
|
|
|
179
179
|
dnastack/context/models.py,sha256=BXSJZSwiopNZ_l2nY8uzofoYebLYwu0BLbirSBIY110,671
|
|
180
180
|
dnastack/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
181
181
|
dnastack/http/client_factory.py,sha256=HdRZpTEnFQcHEdVbdYl7AbCcRUv3K3kVyznIxEWIqvA,650
|
|
182
|
-
dnastack/http/session.py,sha256=
|
|
182
|
+
dnastack/http/session.py,sha256=LAVJW6RzURnHf0lpl3GYQjAzPb9QB9PESOyB7nKesTw,15413
|
|
183
183
|
dnastack/http/session_info.py,sha256=I0m8Z17MCtsWgMCmlzhtOzsXZfUddBAXp0XSOLWfgrM,9366
|
|
184
184
|
dnastack/http/authenticators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
185
185
|
dnastack/http/authenticators/abstract.py,sha256=b5zXqSdCasiy6Bz5LYTr7e_p7l4__Mq5shgTV6bBGnk,9241
|
|
@@ -194,9 +194,9 @@ dnastack/http/authenticators/oauth2_adapter/device_code_flow.py,sha256=dXI5CyUcs
|
|
|
194
194
|
dnastack/http/authenticators/oauth2_adapter/factory.py,sha256=ZtNXOklWEim-26ooNoPp3ji_hRg1vf4fHHnY94F0wLI,1087
|
|
195
195
|
dnastack/http/authenticators/oauth2_adapter/models.py,sha256=iY7asrSElyjubInrGV5rJKKZAxJWeq7csnaj-EqMq00,943
|
|
196
196
|
dnastack/http/authenticators/oauth2_adapter/token_exchange.py,sha256=nSuAsSKWa_UNqHSbPMOEk4komaFITYAnE04Sk5WOrLc,6332
|
|
197
|
-
dnastack_client_library-3.1.
|
|
198
|
-
dnastack_client_library-3.1.
|
|
199
|
-
dnastack_client_library-3.1.
|
|
200
|
-
dnastack_client_library-3.1.
|
|
201
|
-
dnastack_client_library-3.1.
|
|
202
|
-
dnastack_client_library-3.1.
|
|
197
|
+
dnastack_client_library-3.1.162.dist-info/licenses/LICENSE,sha256=uwybO-wUbQhxkosgjhJlxmYATMy-AzoULFO9FUedE34,11580
|
|
198
|
+
dnastack_client_library-3.1.162.dist-info/METADATA,sha256=hE05Y8wAcmuy8xIoXPuktKrh5pqISri-tDkdQ8Guv0s,1766
|
|
199
|
+
dnastack_client_library-3.1.162.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
200
|
+
dnastack_client_library-3.1.162.dist-info/entry_points.txt,sha256=Y6OeicsiyGn3-8D-SiV4NiKlJgXfkSqK88kFBR6R1rY,89
|
|
201
|
+
dnastack_client_library-3.1.162.dist-info/top_level.txt,sha256=P2RgRyqJ7hfNy1wLVRoVLJYEppUVkCX3syGK9zBqkt8,9
|
|
202
|
+
dnastack_client_library-3.1.162.dist-info/RECORD,,
|
{dnastack_client_library-3.1.160.dist-info → dnastack_client_library-3.1.162.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|