aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/downloader/http.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-06-24 13:40:17 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-06-25 00:08:55 +0530
commitac668111128b5f124b4271b3aa4c35f6e71a4749 (patch)
tree2a824880c707248076748070f7505cfb05200399 /yt_dlp/downloader/http.py
parent3c5386cd711a5a0480a0b8d72e9df5007b10ac92 (diff)
downloadhypervideo-pre-ac668111128b5f124b4271b3aa4c35f6e71a4749.tar.lz
hypervideo-pre-ac668111128b5f124b4271b3aa4c35f6e71a4749.tar.xz
hypervideo-pre-ac668111128b5f124b4271b3aa4c35f6e71a4749.zip
[compat] Remove more functions
Removing any more will require changes to a large number of extractors
Diffstat (limited to 'yt_dlp/downloader/http.py')
-rw-r--r--yt_dlp/downloader/http.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/yt_dlp/downloader/http.py b/yt_dlp/downloader/http.py
index c6b6627a5..ca5b26498 100644
--- a/yt_dlp/downloader/http.py
+++ b/yt_dlp/downloader/http.py
@@ -3,9 +3,10 @@ import random
import socket
import ssl
import time
+import urllib.error
+import http.client
from .common import FileDownloader
-from ..compat import compat_http_client, compat_urllib_error
from ..utils import (
ContentTooShortError,
ThrottledDownload,
@@ -24,7 +25,7 @@ RESPONSE_READ_EXCEPTIONS = (
socket.timeout, # compat: py < 3.10
ConnectionError,
ssl.SSLError,
- compat_http_client.HTTPException
+ http.client.HTTPException
)
@@ -155,7 +156,7 @@ class HttpFD(FileDownloader):
ctx.resume_len = 0
ctx.open_mode = 'wb'
ctx.data_len = ctx.content_len = int_or_none(ctx.data.info().get('Content-length', None))
- except compat_urllib_error.HTTPError as err:
+ except urllib.error.HTTPError as err:
if err.code == 416:
# Unable to resume (requested range not satisfiable)
try:
@@ -163,7 +164,7 @@ class HttpFD(FileDownloader):
ctx.data = self.ydl.urlopen(
sanitized_Request(url, request_data, headers))
content_length = ctx.data.info()['Content-Length']
- except compat_urllib_error.HTTPError as err:
+ except urllib.error.HTTPError as err:
if err.code < 500 or err.code >= 600:
raise
else:
@@ -196,7 +197,7 @@ class HttpFD(FileDownloader):
# Unexpected HTTP error
raise
raise RetryDownload(err)
- except compat_urllib_error.URLError as err:
+ except urllib.error.URLError as err:
if isinstance(err.reason, ssl.CertificateError):
raise
raise RetryDownload(err)