Home / Class/ HTTPBasicAuth Class — requests Architecture

HTTPBasicAuth Class — requests Architecture

Architecture documentation for the HTTPBasicAuth class in auth.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  c41420c2_875d_0fc2_d80e_b4d487807e05["HTTPBasicAuth"]
  c7a3ca15_217a_21f9_87ee_74879ebf9720["AuthBase"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|extends| c7a3ca15_217a_21f9_87ee_74879ebf9720
  d7a739b0_e73b_9565_f5ed_5e8c24943504["auth.py"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|defined in| d7a739b0_e73b_9565_f5ed_5e8c24943504
  469fce80_2d80_4003_96f8_07d2a89d8e33["__init__()"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|method| 469fce80_2d80_4003_96f8_07d2a89d8e33
  22a5f4cc_f15a_e33f_ae09_0d7d5653aded["__eq__()"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|method| 22a5f4cc_f15a_e33f_ae09_0d7d5653aded
  8b7276e2_4655_abef_2a28_a7c5d6cc6bb3["__ne__()"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|method| 8b7276e2_4655_abef_2a28_a7c5d6cc6bb3
  cbef72a5_7ccf_3765_9a72_b2aa84bb29cb["__call__()"]
  c41420c2_875d_0fc2_d80e_b4d487807e05 -->|method| cbef72a5_7ccf_3765_9a72_b2aa84bb29cb

Relationship Graph

Source Code

src/requests/auth.py lines 76–96

class HTTPBasicAuth(AuthBase):
    """Attaches HTTP Basic Authentication to the given Request object."""

    def __init__(self, username, password):
        self.username = username
        self.password = password

    def __eq__(self, other):
        return all(
            [
                self.username == getattr(other, "username", None),
                self.password == getattr(other, "password", None),
            ]
        )

    def __ne__(self, other):
        return not self == other

    def __call__(self, r):
        r.headers["Authorization"] = _basic_auth_str(self.username, self.password)
        return r

Domain

Extends

Frequently Asked Questions

What is the HTTPBasicAuth class?
HTTPBasicAuth is a class in the requests codebase, defined in src/requests/auth.py.
Where is HTTPBasicAuth defined?
HTTPBasicAuth is defined in src/requests/auth.py at line 76.
What does HTTPBasicAuth extend?
HTTPBasicAuth extends AuthBase.

Analyze Your Own Codebase

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

Try Supermodel Free