dcicutils 8.16.2.1b2__py3-none-any.whl → 8.16.2.1b4__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.
- dcicutils/portal_utils.py +24 -2
- {dcicutils-8.16.2.1b2.dist-info → dcicutils-8.16.2.1b4.dist-info}/METADATA +1 -1
- {dcicutils-8.16.2.1b2.dist-info → dcicutils-8.16.2.1b4.dist-info}/RECORD +6 -6
- {dcicutils-8.16.2.1b2.dist-info → dcicutils-8.16.2.1b4.dist-info}/LICENSE.txt +0 -0
- {dcicutils-8.16.2.1b2.dist-info → dcicutils-8.16.2.1b4.dist-info}/WHEEL +0 -0
- {dcicutils-8.16.2.1b2.dist-info → dcicutils-8.16.2.1b4.dist-info}/entry_points.txt +0 -0
dcicutils/portal_utils.py
CHANGED
@@ -13,6 +13,7 @@ import requests
|
|
13
13
|
from requests.models import Response
|
14
14
|
from threading import Thread
|
15
15
|
from typing import Callable, Dict, List, Optional, Tuple, Type, Union
|
16
|
+
# from urllib.parse import parse_qs as parse_url_query_string
|
16
17
|
from uuid import uuid4 as uuid
|
17
18
|
from webtest.app import TestApp, TestResponse
|
18
19
|
from wsgiref.simple_server import make_server as wsgi_make_server
|
@@ -210,7 +211,8 @@ class Portal:
|
|
210
211
|
|
211
212
|
def get(self, url: str, follow: bool = True,
|
212
213
|
raw: bool = False, database: bool = False,
|
213
|
-
limit: Optional[int] = None, offset: Optional[int] = None,
|
214
|
+
limit: Optional[int] = None, offset: Optional[int] = None,
|
215
|
+
field: Optional[str] = None, deleted: bool = False,
|
214
216
|
raise_for_status: bool = False, **kwargs) -> OptionalResponse:
|
215
217
|
url = self.url(url, raw, database)
|
216
218
|
if isinstance(limit, int) and (limit >= 0):
|
@@ -228,6 +230,11 @@ class Portal:
|
|
228
230
|
url += f"&field={field}"
|
229
231
|
else:
|
230
232
|
url += f"?field={field}"
|
233
|
+
if deleted is True:
|
234
|
+
if "?" in url:
|
235
|
+
url += "&status=deleted"
|
236
|
+
else:
|
237
|
+
url += "?status=deleted"
|
231
238
|
if not self.vapp:
|
232
239
|
response = requests.get(url, allow_redirects=follow, **self._kwargs(**kwargs))
|
233
240
|
else:
|
@@ -270,8 +277,11 @@ class Portal:
|
|
270
277
|
return response
|
271
278
|
|
272
279
|
def get_metadata(self, object_id: str, raw: bool = False, database: bool = False,
|
273
|
-
limit: Optional[int] = None, offset: Optional[int] = None,
|
280
|
+
limit: Optional[int] = None, offset: Optional[int] = None,
|
281
|
+
field: Optional[str] = None, deleted: bool = False,
|
274
282
|
raise_exception: bool = True) -> Optional[dict]:
|
283
|
+
if not isinstance(object_id, str):
|
284
|
+
return None
|
275
285
|
if isinstance(raw, bool) and raw:
|
276
286
|
add_on = "frame=raw" + ("&datastore=database" if isinstance(database, bool) and database else "")
|
277
287
|
elif database:
|
@@ -293,6 +303,18 @@ class Portal:
|
|
293
303
|
add_on += f"&field={field}"
|
294
304
|
else:
|
295
305
|
add_on += f"field={field}"
|
306
|
+
if deleted is True:
|
307
|
+
if add_on:
|
308
|
+
add_on += "&status=deleted"
|
309
|
+
else:
|
310
|
+
add_on += "status=deleted"
|
311
|
+
if (question_mark := object_id.find("?")) > 0:
|
312
|
+
query_string = object_id[question_mark + 1:]
|
313
|
+
object_id = object_id[:question_mark]
|
314
|
+
if add_on:
|
315
|
+
add_on += f"&{query_string}"
|
316
|
+
else:
|
317
|
+
add_on += query_string
|
296
318
|
if raise_exception:
|
297
319
|
return get_metadata(obj_id=object_id, vapp=self.vapp, key=self.key, add_on=add_on)
|
298
320
|
else:
|
@@ -49,7 +49,7 @@ dcicutils/misc_utils.py,sha256=xNQtavXS6vw_x9rQNhZEryo9b19oWYg-A8TzjhVDuxg,11594
|
|
49
49
|
dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
|
50
50
|
dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
|
51
51
|
dcicutils/portal_object_utils.py,sha256=Az3n1aL-PQkN5gOFE6ZqC2XkYsqiwKlq7-tZggs1QN4,11062
|
52
|
-
dcicutils/portal_utils.py,sha256=
|
52
|
+
dcicutils/portal_utils.py,sha256=ttqcs6wNyfe8T_OcGl_AvGXoVD5KKbhwDop7PC8rOaE,47533
|
53
53
|
dcicutils/progress_bar.py,sha256=R3bWLMYM3Xq9PY7U0JadcFT1m7QmCbrbDp9qs9_Kf_c,19472
|
54
54
|
dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
|
55
55
|
dcicutils/qa_checkers.py,sha256=j0kzo_T5VduKTxgsMTp7xjneyNokumZzI_iz55Y0Jjs,20505
|
@@ -75,8 +75,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
|
|
75
75
|
dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
|
76
76
|
dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
|
77
77
|
dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
|
78
|
-
dcicutils-8.16.2.
|
79
|
-
dcicutils-8.16.2.
|
80
|
-
dcicutils-8.16.2.
|
81
|
-
dcicutils-8.16.2.
|
82
|
-
dcicutils-8.16.2.
|
78
|
+
dcicutils-8.16.2.1b4.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
|
79
|
+
dcicutils-8.16.2.1b4.dist-info/METADATA,sha256=aYrIqzp70M24jpcVX85oUjOQcKo2cJd2GS7DFyUkGx0,3493
|
80
|
+
dcicutils-8.16.2.1b4.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
81
|
+
dcicutils-8.16.2.1b4.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
|
82
|
+
dcicutils-8.16.2.1b4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|