Returns the JSON content of the response.
(&self, py: Python<'py>)
| 168 | |
| 169 | /// Returns the JSON content of the response. |
| 170 | pub fn json<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { |
| 171 | let resp = self.inner()?; |
| 172 | future_into_py(py, async move { |
| 173 | resp.json::<Json>() |
| 174 | .await |
| 175 | .map_err(Error::Request) |
| 176 | .map_err(Into::into) |
| 177 | }) |
| 178 | } |
| 179 | |
| 180 | /// Returns the bytes content of the response. |
| 181 | pub fn bytes<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { |