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

This commit is contained in:
Hosam Aly
2015-10-03 16:34:36 +01:00
parent 443d07e0d3
commit 086e19d8e1
+2 -5
View File
@@ -616,11 +616,8 @@ class Response(object):
@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):