dnastack-client-library 3.1.160__py3-none-any.whl → 3.1.168__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.
@@ -152,6 +152,8 @@ def init_questions_commands(group: Group):
152
152
  if invalid_ids:
153
153
  click.echo(f"Error: Invalid collection IDs for this question: {', '.join(invalid_ids)}", err=True)
154
154
  raise click.Abort()
155
+ else:
156
+ collection_ids = [col.id for col in question.collections]
155
157
 
156
158
  # Execute the question
157
159
  results_iter = client.ask_federated_question(
@@ -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
- raise ClientError(
183
- f"Failed to load federated questions: {e.response.text}"
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
- raise ClientError(
251
- f"Invalid question parameters: {e.response.text}"
252
- )
247
+
248
+ raise ClientError(e.response, e.trace, "Invalid question parameters")
253
249
  else:
254
- raise ClientError(
255
- f"Failed to execute federated question: {e.response.text}"
256
- )
250
+
251
+ raise ClientError(e.response, e.trace, "Failed to execute federated question")
dnastack/constants.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import os
2
2
 
3
- __version__ = "v3.1.160"
3
+ __version__ = "v3.1.168"
4
4
 
5
5
  LOCAL_STORAGE_DIRECTORY = os.path.join(os.path.expanduser("~"), '.dnastack')
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dnastack-client-library
3
- Version: 3.1.160
3
+ Version: 3.1.168
4
4
  Summary: DNAstack's GA4GH library and CLI
5
5
  Author-email: DNAstack <devs@dnastack.com>
6
6
  License: Apache License, Version 2.0
@@ -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=gddQdVRGL-wmdJ9LGIac_q3bwrCV5rzW-isACUNjOJI,114
3
+ dnastack/constants.py,sha256=uuuxY_BJ60LgFuqhtfDC10aGSLwSJkTa4X8j8IyE1Zg,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
@@ -52,7 +52,7 @@ dnastack/cli/commands/drs/utils.py,sha256=tGogaIlXKnk03GqitzeDfo893JlP7Nc_X28sH-
52
52
  dnastack/cli/commands/explorer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  dnastack/cli/commands/explorer/commands.py,sha256=X1gvnH3TPoE4BIVBBVA2BMRQpA4qT3XhcjxsfRftMoI,589
54
54
  dnastack/cli/commands/explorer/questions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
- dnastack/cli/commands/explorer/questions/commands.py,sha256=37-BnAxCh0dEPe5BpBh06esMdtfoF73xL5zhQ2aLK5w,6129
55
+ dnastack/cli/commands/explorer/questions/commands.py,sha256=iV25gL9kLADjsBmQkUHRnYp-U5bIJuYDUIjfsGpT0FQ,6213
56
56
  dnastack/cli/commands/explorer/questions/tables.py,sha256=cb8YKqY7Qxrm2ROz7z8H6bGp964BNEipuX8KaThTveo,4337
57
57
  dnastack/cli/commands/explorer/questions/utils.py,sha256=HNBHEV_F-41IyfnG1ZfxMnacp11UvhwnH4Z2DKgxPZs,7634
58
58
  dnastack/cli/commands/publisher/__init__.py,sha256=G8WNdx1UwanoA4X349ghv8Zyv5YizB8ryeJmwu9px8o,443
@@ -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=A_C2YN5rLc-KqOBxmYHvLcq1tbRrRwRdfmV8DwcQAuQ,9511
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=R-rsE_TTswlTTlqJW7a6_O-sVMmbrnEMnKBf7m_5I8U,15058
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.160.dist-info/licenses/LICENSE,sha256=uwybO-wUbQhxkosgjhJlxmYATMy-AzoULFO9FUedE34,11580
198
- dnastack_client_library-3.1.160.dist-info/METADATA,sha256=MhN44vdROVWBseHG309SvqkHlvKcnT3AEigPkn2iImk,1766
199
- dnastack_client_library-3.1.160.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
200
- dnastack_client_library-3.1.160.dist-info/entry_points.txt,sha256=Y6OeicsiyGn3-8D-SiV4NiKlJgXfkSqK88kFBR6R1rY,89
201
- dnastack_client_library-3.1.160.dist-info/top_level.txt,sha256=P2RgRyqJ7hfNy1wLVRoVLJYEppUVkCX3syGK9zBqkt8,9
202
- dnastack_client_library-3.1.160.dist-info/RECORD,,
197
+ dnastack_client_library-3.1.168.dist-info/licenses/LICENSE,sha256=uwybO-wUbQhxkosgjhJlxmYATMy-AzoULFO9FUedE34,11580
198
+ dnastack_client_library-3.1.168.dist-info/METADATA,sha256=q6nHnGlEfbHDHArIU0ZQ7VofZcaq_7rVDM9ZBW8q-JQ,1766
199
+ dnastack_client_library-3.1.168.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
200
+ dnastack_client_library-3.1.168.dist-info/entry_points.txt,sha256=Y6OeicsiyGn3-8D-SiV4NiKlJgXfkSqK88kFBR6R1rY,89
201
+ dnastack_client_library-3.1.168.dist-info/top_level.txt,sha256=P2RgRyqJ7hfNy1wLVRoVLJYEppUVkCX3syGK9zBqkt8,9
202
+ dnastack_client_library-3.1.168.dist-info/RECORD,,