Method
_json_call
(
self,
method: str,
path: str,
params: Optional[
Mapping[str, Union[None, str, int, float, bool, list, tuple]]
] = None,
headers: Optional[Mapping[str, str]] = None,
timeout: Optional[float] = None,
body: Optional[Union[bytes, str]] = None,
expect_json: bool = True,
)
Source from the content-addressed store, hash-verified
| 324 | |
| 325 | # Internal utilities |
| 326 | def _json_call( |
| 327 | self, |
| 328 | method: str, |
| 329 | path: str, |
| 330 | params: Optional[ |
| 331 | Mapping[str, Union[None, str, int, float, bool, list, tuple]] |
| 332 | ] = None, |
| 333 | headers: Optional[Mapping[str, str]] = None, |
| 334 | timeout: Optional[float] = None, |
| 335 | body: Optional[Union[bytes, str]] = None, |
| 336 | expect_json: bool = True, |
| 337 | ) -> Union[HttpResponse, Any]: |
| 338 | resp = self.request( |
| 339 | method=method, |
| 340 | path=path, |
| 341 | params=params, |
| 342 | headers=headers, |
| 343 | body=body, |
| 344 | timeout=timeout, |
| 345 | ) |
| 346 | if not (200 <= resp.status < 400): |
| 347 | raise HttpError(resp.status, resp.url, resp.text()) |
| 348 | if expect_json: |
| 349 | return resp.json() |
| 350 | return resp |
| 351 | |
| 352 | def _prepare_body( |
| 353 | self, json_body: Optional[Any] = None, data: Optional[Union[bytes, str]] = None |
Tested by
no test coverage detected