Home / Function/ _patch_adapter_gzipped_redirect() — requests Function Reference

_patch_adapter_gzipped_redirect() — requests Function Reference

Architecture documentation for the _patch_adapter_gzipped_redirect() function in test_requests.py from the requests codebase.

Function python CoreAPI SessionLifecycle calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d54c8979_096f_53b2_ee13_71309e1bb559["_patch_adapter_gzipped_redirect()"]
  22b80b19_26d4_cd0e_c476_3edf87b3df14["TestRequests"]
  d54c8979_096f_53b2_ee13_71309e1bb559 -->|defined in| 22b80b19_26d4_cd0e_c476_3edf87b3df14
  09c85eb3_364c_b7fb_c9b5_e901d483c120["test_redirect_with_wrong_gzipped_header()"]
  09c85eb3_364c_b7fb_c9b5_e901d483c120 -->|calls| d54c8979_096f_53b2_ee13_71309e1bb559
  ccc37729_feb7_52c6_708d_eea515a31776["build_response()"]
  d54c8979_096f_53b2_ee13_71309e1bb559 -->|calls| ccc37729_feb7_52c6_708d_eea515a31776
  style d54c8979_096f_53b2_ee13_71309e1bb559 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_requests.py lines 2063–2075

    def _patch_adapter_gzipped_redirect(self, session, url):
        adapter = session.get_adapter(url=url)
        org_build_response = adapter.build_response
        self._patched_response = False

        def build_response(*args, **kwargs):
            resp = org_build_response(*args, **kwargs)
            if not self._patched_response:
                resp.raw.headers["content-encoding"] = "gzip"
                self._patched_response = True
            return resp

        adapter.build_response = build_response

Domain

Subdomains

Frequently Asked Questions

What does _patch_adapter_gzipped_redirect() do?
_patch_adapter_gzipped_redirect() is a function in the requests codebase, defined in tests/test_requests.py.
Where is _patch_adapter_gzipped_redirect() defined?
_patch_adapter_gzipped_redirect() is defined in tests/test_requests.py at line 2063.
What does _patch_adapter_gzipped_redirect() call?
_patch_adapter_gzipped_redirect() calls 1 function(s): build_response.
What calls _patch_adapter_gzipped_redirect()?
_patch_adapter_gzipped_redirect() is called by 1 function(s): test_redirect_with_wrong_gzipped_header.

Analyze Your Own Codebase

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

Try Supermodel Free