X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2Futils.py;h=25b67db0665af756ee32dac797f18a647004ff1f;hb=3cc687d486c5fc4710b6fdec4340b7635cec91c9;hp=4dcf18991487d7a180a5d4b903bad4b38b3165db;hpb=796173d08b514182eedc704541eb55d5c9e1dc0d;p=youtube-dl.git diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 4dcf18991..25b67db06 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -51,6 +51,12 @@ try: except ImportError: # Python 2 import httplib as compat_http_client +try: + from subprocess import DEVNULL + compat_subprocess_get_DEVNULL = lambda: DEVNULL +except ImportError: + compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w') + try: from urllib.parse import parse_qs as compat_parse_qs except ImportError: # Python 2 @@ -506,3 +512,6 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler): resp = self.addinfourl_wrapper(gz, old_resp.headers, old_resp.url, old_resp.code) resp.msg = old_resp.msg return resp + + https_request = http_request + https_response = http_response