Skip to content
Myr

Fall back to streaming

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

authored by Skipper Seabold · committed by Nate Prewitt · parent d4965a4 · Browse files · 1 file+5 added−1 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+5 added−1 removed

  • other:+5 added−1 removed

1 file+5 added−1 removed

modified:requests/utils.py+5 added-1 removed
81 unmodified lines
82 # This can happen in some weird situations, such as when the file83 # is actually a special file descriptor like stdin. In this84 # instance, we don't know what the length is, so set it to zero and85 # let requests chunk it instead.86 if total_length is not None:86 current_position = total_length87 current_position = total_length8889 if hasattr(o, 'seek') and total_length is None:90 # StringIO has a notimplemented fileno91 # BytesIO has seek and not fileno
6 unmodified lines
9899 # seek back to current position to support partially read file-like100 o.seek(current_position or 0)101102 if total_length is None:103 total_length = 0104105 return max(0, total_length - current_position)106107108def get_netrc_auth(url, raise_errors=False):
722 unmodified lines