2023-05-20 21:56:23 +00:00
|
|
|
"""Deprecated - New code should avoid these"""
|
2023-07-15 09:00:08 +00:00
|
|
|
import warnings
|
|
|
|
|
|
|
|
from ..compat.compat_utils import passthrough_module
|
|
|
|
|
|
|
|
# XXX: Implement this the same way as other DeprecationWarnings without circular import
|
|
|
|
passthrough_module(__name__, '.._legacy', callback=lambda attr: warnings.warn(
|
|
|
|
DeprecationWarning(f'{__name__}.{attr} is deprecated'), stacklevel=6))
|
|
|
|
del passthrough_module
|
|
|
|
|
2023-05-20 21:56:23 +00:00
|
|
|
|
|
|
|
from ._utils import preferredencoding
|
2023-07-15 10:25:23 +00:00
|
|
|
from ..networking._urllib import HTTPHandler
|
2023-05-20 21:56:23 +00:00
|
|
|
|
2023-07-15 09:00:08 +00:00
|
|
|
# isort: split
|
2023-07-15 10:25:23 +00:00
|
|
|
from .networking import random_user_agent, std_headers # noqa: F401
|
2023-07-15 09:00:08 +00:00
|
|
|
from ..networking._urllib import PUTRequest # noqa: F401
|
|
|
|
from ..networking._urllib import SUPPORTED_ENCODINGS, HEADRequest # noqa: F401
|
|
|
|
from ..networking._urllib import ProxyHandler as PerRequestProxyHandler # noqa: F401
|
|
|
|
from ..networking._urllib import RedirectHandler as YoutubeDLRedirectHandler # noqa: F401
|
|
|
|
from ..networking._urllib import make_socks_conn_class, update_Request # noqa: F401
|
|
|
|
from ..networking.exceptions import network_exceptions # noqa: F401
|
|
|
|
|
2023-05-20 21:56:23 +00:00
|
|
|
|
|
|
|
def encodeFilename(s, for_subprocess=False):
|
|
|
|
assert isinstance(s, str)
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
|
|
def decodeFilename(b, for_subprocess=False):
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
def decodeArgument(b):
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
def decodeOption(optval):
|
|
|
|
if optval is None:
|
|
|
|
return optval
|
|
|
|
if isinstance(optval, bytes):
|
|
|
|
optval = optval.decode(preferredencoding())
|
|
|
|
|
|
|
|
assert isinstance(optval, str)
|
|
|
|
return optval
|
|
|
|
|
|
|
|
|
|
|
|
def error_to_compat_str(err):
|
|
|
|
return str(err)
|
2023-07-15 10:25:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
class YoutubeDLHandler(HTTPHandler):
|
|
|
|
def __init__(self, params, *args, **kwargs):
|
|
|
|
self._params = params
|
|
|
|
super().__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
YoutubeDLHTTPSHandler = YoutubeDLHandler
|