|
|
@ -10,6 +10,7 @@ import os
|
|
|
|
import random
|
|
|
|
import random
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
|
|
|
|
|
import ssl
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
import math
|
|
|
|
import math
|
|
|
@ -623,9 +624,12 @@ class InfoExtractor(object):
|
|
|
|
url_or_request = update_url_query(url_or_request, query)
|
|
|
|
url_or_request = update_url_query(url_or_request, query)
|
|
|
|
if data is not None or headers:
|
|
|
|
if data is not None or headers:
|
|
|
|
url_or_request = sanitized_Request(url_or_request, data, headers)
|
|
|
|
url_or_request = sanitized_Request(url_or_request, data, headers)
|
|
|
|
|
|
|
|
exceptions = [compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error]
|
|
|
|
|
|
|
|
if hasattr(ssl, 'CertificateError'):
|
|
|
|
|
|
|
|
exceptions.append(ssl.CertificateError)
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return self._downloader.urlopen(url_or_request)
|
|
|
|
return self._downloader.urlopen(url_or_request)
|
|
|
|
except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
|
|
|
|
except tuple(exceptions) as err:
|
|
|
|
if isinstance(err, compat_urllib_error.HTTPError):
|
|
|
|
if isinstance(err, compat_urllib_error.HTTPError):
|
|
|
|
if self.__can_accept_status_code(err, expected_status):
|
|
|
|
if self.__can_accept_status_code(err, expected_status):
|
|
|
|
# Retain reference to error to prevent file object from
|
|
|
|
# Retain reference to error to prevent file object from
|
|
|
|