Skip to content
Myr

Merge pull request #3877 from sigmavirus24/update-docstring

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

Correct docstring for Response.ok

authored by Ian Cordasco · committed by GitHub · parents e674aa1, 8e049bd · Browse files · 1 file+21 added−3 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+21 added−3 removed

  • other:+21 added−3 removed

1 file+21 added−3 removed

modified:requests/models.py+21 added-3 removed
657 unmodified lines
658 def __repr__(self):659 return '<Response [%s]>' % (self.status_code)660661 def __bool__(self):662 """Returns true if :attr:`status_code` is 'OK'."""662 """Returns True if :attr:`status_code` is less than 400.663664 This attribute checks if the status code of the response is between665 400 and 600 to see if there was a client error or a server error. If666 the status code, is between 200 and 400, this will return True. This667 is **not** a check to see if the response code is ``200 OK``.668 """669 return self.ok670671 def __nonzero__(self):666 """Returns true if :attr:`status_code` is 'OK'."""672 """Returns True if :attr:`status_code` is less than 400.673674 This attribute checks if the status code of the response is between675 400 and 600 to see if there was a client error or a server error. If676 the status code, is between 200 and 400, this will return True. This677 is **not** a check to see if the response code is ``200 OK``.678 """679 return self.ok680681 def __iter__(self):682 """Allows you to use a response as an iterator."""683 return self.iter_content(128)684685 @property686 def ok(self):675 """Returns true if :attr:`status_code` is 'OK'."""687 """Returns True if :attr:`status_code` is less than 400.688689 This attribute checks if the status code of the response is between690 400 and 600 to see if there was a client error or a server error. If691 the status code, is between 200 and 400, this will return True. This692 is **not** a check to see if the response code is ``200 OK``.693 """694 try:695 self.raise_for_status()696 except HTTPError:697 return False
244 unmodified lines