__bool__() — requests Function Reference
Architecture documentation for the __bool__() function in models.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 688401b6_9092_b23f_4739_e55b00c176e1["__bool__()"] eb32847e_3797_d01a_6e44_345e9ea7e251["Response"] 688401b6_9092_b23f_4739_e55b00c176e1 -->|defined in| eb32847e_3797_d01a_6e44_345e9ea7e251 style 688401b6_9092_b23f_4739_e55b00c176e1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/models.py lines 732–740
def __bool__(self):
"""Returns True if :attr:`status_code` is less than 400.
This attribute checks if the status code of the response is between
400 and 600 to see if there was a client error or a server error. If
the status code, is between 200 and 400, this will return True. This
is **not** a check to see if the response code is ``200 OK``.
"""
return self.ok
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does __bool__() do?
__bool__() is a function in the requests codebase, defined in src/requests/models.py.
Where is __bool__() defined?
__bool__() is defined in src/requests/models.py at line 732.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free