Skip to content
Myr

Use the new urllib3 stream generator.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent ecf57ca · Browse files · 1 file+12 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−5 removed

  • other:+12 added−5 removed

1 file+12 added−5 removed

modified:requests/models.py+12 added-5 removed
535 unmodified lines
536 # simulate reading small chunks of the content537 return iter_slices(self._content, chunk_size)538539 def generate():540 try:541 # Special case for urllib3.542 for chunk in self.raw.stream(chunk_size, decode_content=True):543 yield chunk544 except AttributeError:545 # Standard file-like object.540 while 1:541 chunk = self.raw.read(chunk_size, decode_content=True)542 if not chunk:543 break544 yield chunk546 while 1:547 chunk = self.raw.read(chunk_size, decode_content=True)548 if not chunk:549 break550 yield chunk551552 self._content_consumed = True553554 gen = generate()555
138 unmodified lines