import sys
import socket
import time
-import urllib
+try:
+ from urllib.parse import splittype, splithost, splittag
+except ImportError:
+ from urllib import splittype, splithost, splittag
from urlparse import urljoin
from m_lib.md5wrapper import md5wrapper
self.start = int(time.time())
bookmark.icon = None
- url_type, url_rest = urllib.splittype(bookmark.href)
- url_host, url_path = urllib.splithost(url_rest)
- url_path, url_tag = urllib.splittag(url_path) # noqa: E221
- # multiple spaces before operator
+ url_type, url_rest = splittype(bookmark.href)
+ url_host, url_path = splithost(url_rest)
+ url_path, url_tag = splittag(url_path) # noqa: E221
+ # multiple spaces before operator
url = "%s://%s%s" % (url_type, url_host, url_path)
error, redirect_code, redirect_to, headers, content = \