Home / Function/ content() — requests Function Reference

content() — requests Function Reference

Architecture documentation for the content() function in models.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  1c1a1a8e_6f9f_4aff_15d5_66872a75ed6a["content()"]
  eb32847e_3797_d01a_6e44_345e9ea7e251["Response"]
  1c1a1a8e_6f9f_4aff_15d5_66872a75ed6a -->|defined in| eb32847e_3797_d01a_6e44_345e9ea7e251
  1d84ce86_28dc_c5f4_e8af_24874e68169e["iter_content()"]
  1c1a1a8e_6f9f_4aff_15d5_66872a75ed6a -->|calls| 1d84ce86_28dc_c5f4_e8af_24874e68169e
  style 1c1a1a8e_6f9f_4aff_15d5_66872a75ed6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/models.py lines 893–909

    def content(self):
        """Content of the response, in bytes."""

        if self._content is False:
            # Read the contents.
            if self._content_consumed:
                raise RuntimeError("The content for this response was already consumed")

            if self.status_code == 0 or self.raw is None:
                self._content = None
            else:
                self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""

        self._content_consumed = True
        # don't need to release the connection; that's been handled by urllib3
        # since we exhausted the data.
        return self._content

Domain

Subdomains

Frequently Asked Questions

What does content() do?
content() is a function in the requests codebase, defined in src/requests/models.py.
Where is content() defined?
content() is defined in src/requests/models.py at line 893.
What does content() call?
content() calls 1 function(s): iter_content.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free