Converts the response iterator in a list. By default this happens automatically if required. If `implicit_sequence_conversion` is disabled, this method is not automatically called and some properties might raise exceptions. This also encodes all the items. .. vers
(self)
| 339 | self.make_sequence() |
| 340 | |
| 341 | def make_sequence(self) -> None: |
| 342 | """Converts the response iterator in a list. By default this happens |
| 343 | automatically if required. If `implicit_sequence_conversion` is |
| 344 | disabled, this method is not automatically called and some properties |
| 345 | might raise exceptions. This also encodes all the items. |
| 346 | |
| 347 | .. versionadded:: 0.6 |
| 348 | """ |
| 349 | if not self.is_sequence: |
| 350 | # if we consume an iterable we have to ensure that the close |
| 351 | # method of the iterable is called if available when we tear |
| 352 | # down the response |
| 353 | close = getattr(self.response, "close", None) |
| 354 | self.response = list(self.iter_encoded()) |
| 355 | if close is not None: |
| 356 | self.call_on_close(close) |
| 357 | |
| 358 | def iter_encoded(self) -> t.Iterator[bytes]: |
| 359 | """Iter the response encoded with the encoding of the response. |