--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py Sat Aug 31 12:29:57 2019 +0200 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUrl.py Sat Aug 31 12:58:11 2019 +0200 @@ -9,18 +9,12 @@ from __future__ import unicode_literals -try: - import urlparse # Py2 - import urllib # Py2 -except ImportError: - import urllib.parse as urllib - from urllib import parse as urlparse - import re import posixpath import socket import struct import hashlib +import urllib.parse import Preferences @@ -70,7 +64,7 @@ @return unescaped URL string @rtype str """ - uu = urllib.unquote(u) + uu = urllib.parse.unquote(u) if uu == u: return uu else: @@ -86,7 +80,7 @@ @rtype str """ safeChars = '!"$&\'()*+,-./:;<=>?@[\\]^_`{|}~' - return urllib.quote(s, safe=safeChars) + return urllib.parse.quote(s, safe=safeChars) url = self.__url.strip() url = url.replace('\n', '').replace('\r', '').replace('\t', '') @@ -96,10 +90,10 @@ if len(url.split('://')) <= 1: url = Preferences.getWebBrowser("DefaultScheme") + url url = quote(fullUnescape(url)) - urlParts = urlparse.urlsplit(url) + urlParts = urllib.parse.parse.urlsplit(url) if not urlParts[0]: url = Preferences.getWebBrowser("DefaultScheme") + url - urlParts = urlparse.urlsplit(url) + urlParts = urllib.parse.parse.urlsplit(url) protocol = urlParts.scheme host = fullUnescape(urlParts.hostname) path = fullUnescape(urlParts.path) @@ -184,10 +178,10 @@ curPath = curPath + pathParts[i] + '/' yield curPath - protocol, addressStr = urllib.splittype(url) - host, path = urllib.splithost(addressStr) - user, host = urllib.splituser(host) - host, port = urllib.splitport(host) + protocol, addressStr = urllib.parse.splittype(url) + host, path = urllib.parse.splithost(addressStr) + user, host = urllib.parse.splituser(host) + host, port = urllib.parse.splitport(host) host = host.strip('/') seenPermutations = set() for h in hostPermutations(host):