Skip to content
Myr

response error handling rework

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

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 2e4724c · Browse files · 1 file+6 added−4 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+6 added−4 removed

  • other:+6 added−4 removed

1 file+6 added−4 removed

modified:requests/models.py+6 added-4 removed
156 unmodified lines
157158 return opener.open159160161 def _build_response(self, resp):161 def _build_response(self, resp, is_error=False):162 """Build internal :class:`Response <models.Response>` object from given response."""163164 def build(resp):165
6 unmodified lines
172 response.close = resp.close173 except AttributeError:174 pass175176 if is_error:177 response.error = resp178179 response.url = getattr(resp, 'url', None)180181 return response182
131 unmodified lines
314 if hasattr(why, 'reason'):315 if isinstance(why.reason, socket.timeout):316 why = Timeout(why)317315 self._build_response(why)316 if not self.redirect:317 self.response.error = why318 self._build_response(why, is_error=True)319320321 else:322 self._build_response(resp)323 self.response.ok = True324
242 unmodified lines