Returns the JSON content of the response.
(&self, py: Python)
| 115 | |
| 116 | /// Returns the JSON content of the response. |
| 117 | pub fn json(&self, py: Python) -> PyResult<Json> { |
| 118 | py.allow_threads(|| { |
| 119 | let resp = self.0.inner()?; |
| 120 | pyo3_async_runtimes::tokio::get_runtime() |
| 121 | .block_on(resp.json::<Json>()) |
| 122 | .map_err(Error::Request) |
| 123 | .map_err(Into::into) |
| 124 | }) |
| 125 | } |
| 126 | |
| 127 | /// Returns the bytes content of the response. |
| 128 | pub fn bytes(&self, py: Python) -> PyResult<Py<PyAny>> { |