Skip to content
Myr

Update docstrings for Response.__{bool,nonzero}__

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

Like the docstring added to Response.ok these were misleading and vaguely incorrect. Better to be explicit than implicit.

authored by Ian Cordasco · committed by Ian Cordasco · parent 7a281e7 · Browse files · 1 file+14 added−2 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+14 added−2 removed

  • other:+14 added−2 removed

1 file+14 added−2 removed

modified:requests/models.py+14 added-2 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."""
259 unmodified lines