Send a request via the legacy client and validate the response envelope. Combines ``legacy._request`` (HTTP-level error handling) with application-level ``{"Code": 200, ...}`` envelope validation. Returns the parsed JSON body dict on success.
(
self,
method: str,
path: str,
**kwargs: Any,
)
| 154 | # Internal transport helper |
| 155 | # ------------------------------------------------------------------ |
| 156 | def _legacy_request( |
| 157 | self, |
| 158 | method: str, |
| 159 | path: str, |
| 160 | **kwargs: Any, |
| 161 | ) -> dict: |
| 162 | """Send a request via the legacy client and validate the response envelope. |
| 163 | |
| 164 | Combines ``legacy._request`` (HTTP-level error handling) with |
| 165 | application-level ``{"Code": 200, ...}`` envelope validation. |
| 166 | Returns the parsed JSON body dict on success. |
| 167 | """ |
| 168 | from modelscope.hub.errors import raise_on_error |
| 169 | resp = self._api.legacy._request(method, path, **kwargs) |
| 170 | body = resp.json() |
| 171 | raise_on_error(body) |
| 172 | return body |
| 173 | |
| 174 | # ------------------------------------------------------------------ |
| 175 | # OSS dataset operations |
no test coverage detected