mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
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:
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user