mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-06-08 06:18:52 +02:00
slight impl change
Authored by: bashonly
This commit is contained in:
parent
64d4c4ba72
commit
3b48105b8c
|
@ -81,7 +81,7 @@ def close(self):
|
|||
class CurlCFFIResponseAdapter(ImpersonateResponse):
|
||||
fp: CurlCFFIResponseReader
|
||||
|
||||
def __init__(self, response: curl_cffi.requests.Response, impersonate: ImpersonateTarget):
|
||||
def __init__(self, response: curl_cffi.requests.Response, impersonate: ImpersonateTarget | None):
|
||||
super().__init__(
|
||||
fp=CurlCFFIResponseReader(response),
|
||||
headers=response.headers,
|
||||
|
|
|
@ -517,6 +517,7 @@ def __init__(
|
|||
self.reason = reason or HTTPStatus(status).phrase
|
||||
except ValueError:
|
||||
self.reason = None
|
||||
self.extras = {}
|
||||
|
||||
def readable(self):
|
||||
return self.fp.readable()
|
||||
|
|
|
@ -65,9 +65,10 @@ class ImpersonateResponse(Response):
|
|||
Parameters:
|
||||
@param impersonate: the ImpersonateTarget used in the originating Request.
|
||||
"""
|
||||
def __init__(self, *args, impersonate: ImpersonateTarget, **kwargs):
|
||||
def __init__(self, *args, impersonate: ImpersonateTarget | None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.impersonate = impersonate
|
||||
if impersonate is not None:
|
||||
self.extras['impersonate'] = impersonate
|
||||
|
||||
|
||||
class ImpersonateRequestHandler(RequestHandler, ABC):
|
||||
|
|
Loading…
Reference in New Issue
Block a user