Handle SSL errors, and specify scheme for CDN URLs

This commit is contained in:
Matt Martz 2016-03-07 17:06:22 -06:00
parent 08e87f4c54
commit 4f7f367391
1 changed files with 4 additions and 3 deletions

View File

@ -205,7 +205,8 @@ else:
# Exception "constants" to support Python 2 through Python 3 # Exception "constants" to support Python 2 through Python 3
try: try:
import ssl import ssl
HTTP_ERRORS = (HTTPError, URLError, socket.error, ssl.SSLError) HTTP_ERRORS = (HTTPError, URLError, socket.error, ssl.SSLError,
ssl.CertificateError)
except ImportError: except ImportError:
HTTP_ERRORS = (HTTPError, URLError, socket.error) HTTP_ERRORS = (HTTPError, URLError, socket.error)
@ -759,9 +760,9 @@ class Speedtest(object):
urls = [ urls = [
'://www.speedtest.net/speedtest-servers-static.php', '://www.speedtest.net/speedtest-servers-static.php',
'://c.speedtest.net/speedtest-servers-static.php', 'http://c.speedtest.net/speedtest-servers-static.php',
'://www.speedtest.net/speedtest-servers.php', '://www.speedtest.net/speedtest-servers.php',
'://c.speedtest.net/speedtest-servers.php', 'http://c.speedtest.net/speedtest-servers.php',
] ]
errors = [] errors = []