visch
03/03/2023, 9:51 PMrequests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer')
I'm surprised I"m the first one to hit this as it didn't retry via backoff. Diving into the requests code base a bit that raised this requests.models.Response
def iter_content(self, chunk_size=1, decode_unicode=False):
"""Iterates over the response data. When stream=True is set on the
request, this avoids reading the content at once into memory for
large responses. The chunk size is the number of bytes it should
read into memory. This is not necessarily the length of each item
returned as decoding can take place.
chunk_size must be of type int or None. A value of None will
function differently depending on the value of `stream`.
stream=True will read data as it arrives in whatever size the
chunks are received. If stream=False, data is returned as
a single chunk.
If decode_unicode is True, content will be decoded using the best
available encoding based on the response.
"""
def generate():
# Special case for urllib3.
if hasattr(self.raw, "stream"):
try:
yield from self.raw.stream(chunk_size, decode_content=True)
except ProtocolError as e:
raise ChunkedEncodingError(e)
except DecodeError as e:
raise ContentDecodingError(e)
except ReadTimeoutError as e:
raise ConnectionError(e)
except SSLError as e:
raise RequestsSSLError(e)
Looks like we could want to retry on all of these, ChunkedEncodingError, ContentDecodingError, and RequestsSSLError?
That's what I"m going to do, curious on thoughts!edgar_ramirez_mondragon
03/03/2023, 10:16 PMvisch
03/03/2023, 10:18 PMvisch
03/03/2023, 10:18 PMedgar_ramirez_mondragon
03/03/2023, 10:19 PMvisch
03/04/2023, 3:25 PM