Skip to content

Commit

Permalink
Clarify the contract of Response#ok, and avoid exceptions in it
Browse files Browse the repository at this point in the history
  • Loading branch information
hosamaly committed Oct 3, 2015
1 parent 443d07e commit 086e19d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,8 @@ def __iter__(self):

@property
def ok(self):
try:
self.raise_for_status()
except HTTPError:
return False
return True
"""True if the status code does *not* indicate an error, i.e. status code < 400."""
return self.status_code < 400

@property
def is_redirect(self):
Expand Down

0 comments on commit 086e19d

Please sign in to comment.