aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/networking/common.py
diff options
context:
space:
mode:
authorbashonly <88596187+bashonly@users.noreply.github.com>2024-05-04 17:19:42 -0500
committerGitHub <noreply@github.com>2024-05-04 22:19:42 +0000
commitbec9a59e8ec82c18e3bf9268eaa436793dd52e35 (patch)
tree181c9801cd2ae5edda75c59cde2ab9d86d89312b /yt_dlp/networking/common.py
parent036e0d92c6052465673d459678322ea03e61483d (diff)
[networking] Add `extensions` attribute to `Response` (#9756)
CurlCFFIRH now provides an `impersonate` field in its responses' extensions Authored by: bashonly
Diffstat (limited to 'yt_dlp/networking/common.py')
-rw-r--r--yt_dlp/networking/common.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/yt_dlp/networking/common.py b/yt_dlp/networking/common.py
index 4c66ba66a..a2217034c 100644
--- a/yt_dlp/networking/common.py
+++ b/yt_dlp/networking/common.py
@@ -497,6 +497,7 @@ class Response(io.IOBase):
@param headers: response headers.
@param status: Response HTTP status code. Default is 200 OK.
@param reason: HTTP status reason. Will use built-in reasons based on status code if not provided.
+ @param extensions: Dictionary of handler-specific response extensions.
"""
def __init__(
@@ -505,7 +506,9 @@ class Response(io.IOBase):
url: str,
headers: Mapping[str, str],
status: int = 200,
- reason: str = None):
+ reason: str = None,
+ extensions: dict = None
+ ):
self.fp = fp
self.headers = Message()
@@ -517,6 +520,7 @@ class Response(io.IOBase):
self.reason = reason or HTTPStatus(status).phrase
except ValueError:
self.reason = None
+ self.extensions = extensions or {}
def readable(self):
return self.fp.readable()