dcicutils 8.7.0.1b4__py3-none-any.whl → 8.7.0.1b5__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 CHANGED
@@ -202,28 +202,45 @@ class Portal:
202
202
  def vapp(self) -> Optional[TestApp]:
203
203
  return self._vapp
204
204
 
205
- def get(self, url: str, follow: bool = True, **kwargs) -> OptionalResponse:
205
+ def get(self, url: str, follow: bool = True, raise_for_status: bool = False, **kwargs) -> OptionalResponse:
206
+ url = self.url(url)
206
207
  if not self._vapp:
207
- return requests.get(self.url(url), allow_redirects=follow, **self._kwargs(**kwargs))
208
- response = self._vapp.get(self.url(url), **self._kwargs(**kwargs))
209
- if response and response.status_code in [301, 302, 303, 307, 308] and follow:
210
- response = response.follow()
211
- return self._response(response)
208
+ response = requests.get(url, allow_redirects=follow, **self._kwargs(**kwargs))
209
+ else:
210
+ response = self._vapp.get(url, **self._kwargs(**kwargs))
211
+ if response and response.status_code in [301, 302, 303, 307, 308] and follow:
212
+ response = response.follow()
213
+ response = self._response(response)
214
+ if raise_for_status:
215
+ response.raise_for_status()
216
+ return response
212
217
 
213
- def patch(self, url: str, data: Optional[dict] = None, json: Optional[dict] = None, **kwargs) -> OptionalResponse:
218
+ def patch(self, url: str, data: Optional[dict] = None, json: Optional[dict] = None,
219
+ raise_for_status: bool = False, **kwargs) -> OptionalResponse:
220
+ url = self.url(url)
214
221
  if not self._vapp:
215
- return requests.patch(self.url(url), data=data, json=json, **self._kwargs(**kwargs))
216
- return self._response(self._vapp.patch_json(self.url(url), json or data, **self._kwargs(**kwargs)))
222
+ response = requests.patch(url, data=data, json=json, **self._kwargs(**kwargs))
223
+ else:
224
+ response = self._vapp.patch_json(url, json or data, **self._kwargs(**kwargs))
225
+ response = self._response(response)
226
+ if raise_for_status:
227
+ response.raise_for_status()
228
+ return response
217
229
 
218
- def post(self, url: str, data: Optional[dict] = None, json: Optional[dict] = None,
219
- files: Optional[dict] = None, **kwargs) -> OptionalResponse:
230
+ def post(self, url: str, data: Optional[dict] = None, json: Optional[dict] = None, files: Optional[dict] = None,
231
+ raise_for_status: bool = False, **kwargs) -> OptionalResponse:
232
+ url = self.url(url)
220
233
  if not self._vapp:
221
- return requests.post(self.url(url), data=data, json=json, files=files, **self._kwargs(**kwargs))
222
- if files:
223
- response = self._vapp.post(self.url(url), json or data, upload_files=files, **self._kwargs(**kwargs))
234
+ response = requests.post(url, data=data, json=json, files=files, **self._kwargs(**kwargs))
224
235
  else:
225
- response = self._vapp.post_json(self.url(url), json or data, upload_files=files, **self._kwargs(**kwargs))
226
- return self._response(response)
236
+ if files:
237
+ response = self._vapp.post(url, json or data, upload_files=files, **self._kwargs(**kwargs))
238
+ else:
239
+ response = self._vapp.post_json(url, json or data, upload_files=files, **self._kwargs(**kwargs))
240
+ response = self._response(response)
241
+ if raise_for_status:
242
+ response.raise_for_status()
243
+ return response
227
244
 
228
245
  def get_metadata(self, object_id: str) -> Optional[dict]:
229
246
  return get_metadata(obj_id=object_id, vapp=self._vapp, key=self._key)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.7.0.1b4
3
+ Version: 8.7.0.1b5
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -43,7 +43,7 @@ dcicutils/log_utils.py,sha256=7pWMc6vyrorUZQf-V-M3YC6zrPgNhuV_fzm9xqTPph0,10883
43
43
  dcicutils/misc_utils.py,sha256=bMRWWxdbhuF3PKdCZEH-H4U1ecgT3Nag3EL92D9XGoY,100973
44
44
  dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
45
45
  dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
46
- dcicutils/portal_utils.py,sha256=e7MnUbEXNOS-_NiCV4Xod3BT_K1Cy-crsRAqZdG_sXo,22528
46
+ dcicutils/portal_utils.py,sha256=0fZ-PMB-oUDroUkMdoZ55xLEpfDz9a94jOZXrK3A0n8,23069
47
47
  dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
48
48
  dcicutils/qa_checkers.py,sha256=cdXjeL0jCDFDLT8VR8Px78aS10hwNISOO5G_Zv2TZ6M,20534
49
49
  dcicutils/qa_utils.py,sha256=TT0SiJWiuxYvbsIyhK9VO4uV_suxhB6CpuC4qPacCzQ,160208
@@ -64,8 +64,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
64
64
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
65
65
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
66
66
  dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
67
- dcicutils-8.7.0.1b4.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
68
- dcicutils-8.7.0.1b4.dist-info/METADATA,sha256=Fc1lyyT3RwFRF93kxrHZ-j8zGImaJktcCUQno5PTXRs,3314
69
- dcicutils-8.7.0.1b4.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
70
- dcicutils-8.7.0.1b4.dist-info/entry_points.txt,sha256=8wbw5csMIgBXhkwfgsgJeuFcoUc0WsucUxmOyml2aoA,209
71
- dcicutils-8.7.0.1b4.dist-info/RECORD,,
67
+ dcicutils-8.7.0.1b5.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
68
+ dcicutils-8.7.0.1b5.dist-info/METADATA,sha256=Dz4-8ARIZnllxNziTwz3y_Jnd-kdoRb2diBJhRh2bUE,3314
69
+ dcicutils-8.7.0.1b5.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
70
+ dcicutils-8.7.0.1b5.dist-info/entry_points.txt,sha256=8wbw5csMIgBXhkwfgsgJeuFcoUc0WsucUxmOyml2aoA,209
71
+ dcicutils-8.7.0.1b5.dist-info/RECORD,,