The docs says about ChunkedEncodingError:
class ChunkedEncodingError(RequestException):
"""The server declared chunked encoding but sent an invalid chunk."""
While this true it's highly confusing. What actually happens is that the server did not respond in time so the connection was closed. The solution is to retry the code and attempt again:
def get(tries=5):
for n in range(tries):
try:
GET call
return whatever
except ChunkedEncodingError as e:
if n == tries - 1:
raise e
This has been asked many time over the internet including even here: #4484
I recommend adding an optional argument for the GET call which will specify the tries number and that will be handled by the get call itself. This will avoid this problem and allow the user more control.
meaning that the GET will return the exception only when the max retries has been reached.
If my suggestion is not accepted at least edit the docs and suggest the template of the solution to avoid the problem.
The docs says about
ChunkedEncodingError:While this true it's highly confusing. What actually happens is that the server did not respond in time so the connection was closed. The solution is to retry the code and attempt again:
This has been asked many time over the internet including even here: #4484
I recommend adding an optional argument for the
GETcall which will specify the tries number and that will be handled by the get call itself. This will avoid this problem and allow the user more control.meaning that the GET will return the exception only when the max retries has been reached.
If my suggestion is not accepted at least edit the docs and suggest the template of the solution to avoid the problem.