Home / Function/ consume_socket_content() — requests Function Reference

consume_socket_content() — requests Function Reference

Architecture documentation for the consume_socket_content() function in server.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  7ab3c4d7_8531_6cbe_e871_9880cb1ee6de["consume_socket_content()"]
  1299f040_d82e_36bb_76ee_892d203f2f6a["server.py"]
  7ab3c4d7_8531_6cbe_e871_9880cb1ee6de -->|defined in| 1299f040_d82e_36bb_76ee_892d203f2f6a
  f1f64f49_bc6b_8fff_3551_2872a2f69101["echo_response_handler()"]
  f1f64f49_bc6b_8fff_3551_2872a2f69101 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  0efab54c_bc4b_14c9_fbe2_34c0ff6e100e["test_chunked_encoding_error()"]
  0efab54c_bc4b_14c9_fbe2_34c0ff6e100e -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  2093ddb9_6b84_c4ae_5b98_b40875536ba6["test_conflicting_content_lengths()"]
  2093ddb9_6b84_c4ae_5b98_b40875536ba6 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  8434b1f0_81b9_349e_19e9_0160771cfc59["test_digestauth_401_count_reset_on_redirect()"]
  8434b1f0_81b9_349e_19e9_0160771cfc59 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  ce1b24b1_670c_c2a7_4a3f_28b5b90bd555["test_digestauth_401_only_sent_once()"]
  ce1b24b1_670c_c2a7_4a3f_28b5b90bd555 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  45a3b6b4_7df6_24a4_7eb3_9e0861b7fdc9["test_digestauth_only_on_4xx()"]
  45a3b6b4_7df6_24a4_7eb3_9e0861b7fdc9 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  884c31ab_a7d6_3dbd_2982_beb0b7fd1003["test_redirect_rfc1808_to_non_ascii_location()"]
  884c31ab_a7d6_3dbd_2982_beb0b7fd1003 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  255f00ae_0b7e_4891_d674_c5b83377ce70["test_fragment_update_on_redirect()"]
  255f00ae_0b7e_4891_d674_c5b83377ce70 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  0b72fab6_7fcc_5b55_2836_f86522b9b99e["test_json_decode_compatibility_for_alt_utf_encodings()"]
  0b72fab6_7fcc_5b55_2836_f86522b9b99e -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  507b0f59_b4bd_1c2b_f879_58d253933ec3["text_response_server()"]
  507b0f59_b4bd_1c2b_f879_58d253933ec3 -->|calls| 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de
  style 7ab3c4d7_8531_6cbe_e871_9880cb1ee6de fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/testserver/server.py lines 7–22

def consume_socket_content(sock, timeout=0.5):
    chunks = 65536
    content = b""

    while True:
        more_to_read = select.select([sock], [], [], timeout)[0]
        if not more_to_read:
            break

        new_content = sock.recv(chunks)
        if not new_content:
            break

        content += new_content

    return content

Domain

Subdomains

Frequently Asked Questions

What does consume_socket_content() do?
consume_socket_content() is a function in the requests codebase, defined in tests/testserver/server.py.
Where is consume_socket_content() defined?
consume_socket_content() is defined in tests/testserver/server.py at line 7.
What calls consume_socket_content()?
consume_socket_content() is called by 10 function(s): echo_response_handler, test_chunked_encoding_error, test_conflicting_content_lengths, test_digestauth_401_count_reset_on_redirect, test_digestauth_401_only_sent_once, test_digestauth_only_on_4xx, test_fragment_update_on_redirect, test_json_decode_compatibility_for_alt_utf_encodings, and 2 more.

Analyze Your Own Codebase

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

Try Supermodel Free