Home / Class/ CustomRedirectSession Class — requests Architecture

CustomRedirectSession Class — requests Architecture

Architecture documentation for the CustomRedirectSession class in test_requests.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  e238a047_9337_d199_c309_0e8209ef5cf4["CustomRedirectSession"]
  69ebfd6f_8f0c_4586_0c19_2c348e1a42a2["test_requests.py"]
  e238a047_9337_d199_c309_0e8209ef5cf4 -->|defined in| 69ebfd6f_8f0c_4586_0c19_2c348e1a42a2
  b05faa36_98b6_6ce8_ee15_eea2e0931c8e["get_redirect_target()"]
  e238a047_9337_d199_c309_0e8209ef5cf4 -->|method| b05faa36_98b6_6ce8_ee15_eea2e0931c8e

Relationship Graph

Source Code

tests/test_requests.py lines 2255–2264

        class CustomRedirectSession(requests.Session):
            def get_redirect_target(self, resp):
                # default behavior
                if resp.is_redirect:
                    return resp.headers["location"]
                # edge case - check to see if 'location' is in headers anyways
                location = resp.headers.get("location")
                if location and (location != resp.url):
                    return location
                return None

Domain

Frequently Asked Questions

What is the CustomRedirectSession class?
CustomRedirectSession is a class in the requests codebase, defined in tests/test_requests.py.
Where is CustomRedirectSession defined?
CustomRedirectSession is defined in tests/test_requests.py at line 2255.

Analyze Your Own Codebase

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

Try Supermodel Free