@@ -659,11 +659,23 @@ def __repr__(self):
659
659
return '<Response [%s]>' % (self .status_code )
660
660
661
661
def __bool__ (self ):
662
- """Returns true if :attr:`status_code` is 'OK'."""
662
+ """Returns True if :attr:`status_code` is less than 400.
663
+
664
+ This attribute checks if the status code of the response is between
665
+ 400 and 600 to see if there was a client error or a server error. If
666
+ the status code, is between 200 and 400, this will return True. This
667
+ is **not** a check to see if the response code is ``200 OK``.
668
+ """
663
669
return self .ok
664
670
665
671
def __nonzero__ (self ):
666
- """Returns true if :attr:`status_code` is 'OK'."""
672
+ """Returns True if :attr:`status_code` is less than 400.
673
+
674
+ This attribute checks if the status code of the response is between
675
+ 400 and 600 to see if there was a client error or a server error. If
676
+ the status code, is between 200 and 400, this will return True. This
677
+ is **not** a check to see if the response code is ``200 OK``.
678
+ """
667
679
return self .ok
668
680
669
681
def __iter__ (self ):
@@ -672,7 +684,13 @@ def __iter__(self):
672
684
673
685
@property
674
686
def ok (self ):
675
- """Returns true if :attr:`status_code` is 'OK'."""
687
+ """Returns True if :attr:`status_code` is less than 400.
688
+
689
+ This attribute checks if the status code of the response is between
690
+ 400 and 600 to see if there was a client error or a server error. If
691
+ the status code, is between 200 and 400, this will return True. This
692
+ is **not** a check to see if the response code is ``200 OK``.
693
+ """
676
694
try :
677
695
self .raise_for_status ()
678
696
except HTTPError :
0 commit comments