Use HTTPS for https urls

This commit is contained in:
auouymous 2019-05-25 15:20:35 +02:00 committed by Mel Collins
parent 8391bafd31
commit 73229700ce
1 changed files with 4 additions and 1 deletions

View File

@ -1402,7 +1402,10 @@ def format_seconds_to_hour_min_sec(seconds):
def http_request(url, method='HEAD'):
(scheme, netloc, path, parms, qry, fragid) = urllib.parse.urlparse(url)
conn = http.client.HTTPConnection(netloc)
if scheme == 'https':
conn = http.client.HTTPSConnection(netloc)
else:
conn = http.client.HTTPConnection(netloc)
start = len(scheme) + len('://') + len(netloc)
conn.request(method, url[start:])
return conn.getresponse()