requests: Add connection property (type HTTPAdapter) to the Response class (#12279)

The `Response` instance is built by `HTTPAdapter`. When built, a property called `connection` is added to the `Response` that points back to the `HTTPAdapter` that created it. For example, this is used in the `requests` library's `HTTPDigestAuth` class to remake requests with credentials after authorization is requested by a server.
This commit is contained in:
Andria Brown
2024-07-11 18:09:07 -06:00
committed by GitHub
parent 96c8ade843
commit ee24958e1e

View File

@@ -8,6 +8,7 @@ from typing_extensions import Self
from urllib3 import exceptions as urllib3_exceptions, fields, filepost, util
from . import auth, cookies, exceptions, hooks, status_codes, utils
from .adapters import HTTPAdapter
from .cookies import RequestsCookieJar
from .structures import CaseInsensitiveDict as CaseInsensitiveDict
@@ -123,6 +124,7 @@ class Response:
cookies: RequestsCookieJar
elapsed: datetime.timedelta
request: PreparedRequest
connection: HTTPAdapter
def __init__(self) -> None: ...
def __bool__(self) -> bool: ...
def __nonzero__(self) -> bool: ...