Returns the bytes content of the response.
(&self, py: Python<'py>)
| 179 | |
| 180 | /// Returns the bytes content of the response. |
| 181 | pub fn bytes<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { |
| 182 | let resp = self.inner()?; |
| 183 | future_into_py(py, async move { |
| 184 | let buffer = resp |
| 185 | .bytes() |
| 186 | .await |
| 187 | .map(BytesBuffer::new) |
| 188 | .map_err(Error::Request)?; |
| 189 | Python::with_gil(|py| buffer.into_bytes(py)) |
| 190 | }) |
| 191 | } |
| 192 | |
| 193 | /// Convert the response into a `Stream` of `Bytes` from the body. |
| 194 | pub fn stream(&self, py: Python) -> PyResult<Streamer> { |
nothing calls this directly
no test coverage detected