Re:On incomplete HTTP reads and the requests library in Python
by cessor on Monday April 23, 2018 @08:59AM
(#16902980)
I fully agree with you.
Altough I really like requests, this is a violation of one of the PEP 20 heuristics:
Errors should never pass silently. Unless explicitly silenced.
https://www.python.org/dev/peps/pep-0020/
An exception would be an elegant way to handle the problem and would be able to retain the incomplete data to be handeled. It's exactly what they are for. The exception could be the default to prevent surprises, possible deactivated with a flag.
This is an awful justification. They should do this by raising an exception and attaching the response data to it, so the user who wants to "muddle through" can catch the exception and "muddle through" explicitly.
Regardless, this is a clear violation of https://en.wikipedia.org/wiki/Fail-fast and disappointing behavior from a package that prides itself on clear, obvious API behavior.