Home / Function/ proxy_headers() — requests Function Reference

proxy_headers() — requests Function Reference

Architecture documentation for the proxy_headers() function in adapters.py from the requests codebase.

Function python CoreAPI SessionLifecycle calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  c8873437_03c5_1072_0f73_3ced2a7902d5["proxy_headers()"]
  5fdf5d52_8295_768a_e20f_c6cefb721b91["HTTPAdapter"]
  c8873437_03c5_1072_0f73_3ced2a7902d5 -->|defined in| 5fdf5d52_8295_768a_e20f_c6cefb721b91
  4e2f0f8e_636e_37d3_f714_243f18338137["proxy_manager_for()"]
  4e2f0f8e_636e_37d3_f714_243f18338137 -->|calls| c8873437_03c5_1072_0f73_3ced2a7902d5
  1a78d81a_ddf9_f329_5c88_eabcf1bdece2["get_auth_from_url()"]
  c8873437_03c5_1072_0f73_3ced2a7902d5 -->|calls| 1a78d81a_ddf9_f329_5c88_eabcf1bdece2
  fa72bb6a_120a_ce88_fe4e_28d8c4d3b882["_basic_auth_str()"]
  c8873437_03c5_1072_0f73_3ced2a7902d5 -->|calls| fa72bb6a_120a_ce88_fe4e_28d8c4d3b882
  style c8873437_03c5_1072_0f73_3ced2a7902d5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/requests/adapters.py lines 571–590

    def proxy_headers(self, proxy):
        """Returns a dictionary of the headers to add to any request sent
        through a proxy. This works with urllib3 magic to ensure that they are
        correctly sent to the proxy, rather than in a tunnelled request if
        CONNECT is being used.

        This should not be called from user code, and is only exposed for use
        when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param proxy: The url of the proxy being used for this request.
        :rtype: dict
        """
        headers = {}
        username, password = get_auth_from_url(proxy)

        if username:
            headers["Proxy-Authorization"] = _basic_auth_str(username, password)

        return headers

Domain

Subdomains

Frequently Asked Questions

What does proxy_headers() do?
proxy_headers() is a function in the requests codebase, defined in src/requests/adapters.py.
Where is proxy_headers() defined?
proxy_headers() is defined in src/requests/adapters.py at line 571.
What does proxy_headers() call?
proxy_headers() calls 2 function(s): _basic_auth_str, get_auth_from_url.
What calls proxy_headers()?
proxy_headers() is called by 1 function(s): proxy_manager_for.

Analyze Your Own Codebase

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

Try Supermodel Free