Skip to content
Myr

Clarify the contract of Response#ok, and avoid exceptions in it

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

authored by Hosam Aly · committed by Hosam Aly · parent 443d07e · Browse files · 1 file+2 added−5 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+2 added−5 removed

  • other:+2 added−5 removed

1 file+2 added−5 removed

modified:requests/models.py+2 added-5 removed
614 unmodified lines
615 return self.iter_content(128)616617 @property618 def ok(self):619 try:620 self.raise_for_status()621 except HTTPError:622 return False623 return True619 """True if the status code does *not* indicate an error, i.e. status code < 400."""620 return self.status_code < 400621622 @property623 def is_redirect(self):624 """True if this Response is a well-formed HTTP redirect that could have
221 unmodified lines