mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Clarify the contract of Response#ok, and avoid exceptions in it
This commit is contained in:
+2
-5
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user