]>
Commit | Line | Data |
---|---|---|
69bec673 | 1 | """Deprecated - New code should avoid these""" |
c365dba8 | 2 | import warnings |
3 | ||
4 | from ..compat.compat_utils import passthrough_module | |
5 | ||
6 | # XXX: Implement this the same way as other DeprecationWarnings without circular import | |
7 | passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn( | |
8 | DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6)) | |
9 | del passthrough_module | |
10 | ||
69bec673 | 11 | |
12 | from ._utils import preferredencoding | |
227bf1a3 | 13 | from ..networking._urllib import HTTPHandler |
69bec673 | 14 | |
c365dba8 | 15 | # isort: split |
227bf1a3 | 16 | from .networking import random_user_agent, std_headers # noqa: F401 |
c365dba8 | 17 | from ..networking._urllib import PUTRequest # noqa: F401 |
18 | from ..networking._urllib import SUPPORTED_ENCODINGS, HEADRequest # noqa: F401 | |
c365dba8 | 19 | from ..networking._urllib import ProxyHandler as PerRequestProxyHandler # noqa: F401 |
20 | from ..networking._urllib import RedirectHandler as YoutubeDLRedirectHandler # noqa: F401 | |
21 | from ..networking._urllib import make_socks_conn_class, update_Request # noqa: F401 | |
22 | from ..networking.exceptions import network_exceptions # noqa: F401 | |
c365dba8 | 23 | |
69bec673 | 24 | |
25 | def encodeFilename(s, for_subprocess=False): | |
26 | assert isinstance(s, str) | |
27 | return s | |
28 | ||
29 | ||
30 | def decodeFilename(b, for_subprocess=False): | |
31 | return b | |
32 | ||
33 | ||
34 | def decodeArgument(b): | |
35 | return b | |
36 | ||
37 | ||
38 | def decodeOption(optval): | |
39 | if optval is None: | |
40 | return optval | |
41 | if isinstance(optval, bytes): | |
42 | optval = optval.decode(preferredencoding()) | |
43 | ||
44 | assert isinstance(optval, str) | |
45 | return optval | |
46 | ||
47 | ||
48 | def error_to_compat_str(err): | |
49 | return str(err) | |
227bf1a3 | 50 | |
51 | ||
52 | class YoutubeDLHandler(HTTPHandler): | |
53 | def __init__(self, params, *args, **kwargs): | |
54 | self._params = params | |
55 | super().__init__(*args, **kwargs) | |
56 | ||
57 | ||
58 | YoutubeDLHTTPSHandler = YoutubeDLHandler |