diff --git a/pydu/compat.py b/pydu/compat.py index 0444588..9700eae 100644 --- a/pydu/compat.py +++ b/pydu/compat.py @@ -4,10 +4,14 @@ import sys PY2 = sys.version_info[0] == 2 -# urljoin +# urllib, urlparse and urljoin if PY2: + import urllib as ulib + import urlparse from urlparse import urljoin else: + import urllib.request as ulib + import urllib.parse as urlparse from urllib.parse import urljoin # Dictionary iteration diff --git a/pydu/request.py b/pydu/request.py index b74660a..ee7ff37 100644 --- a/pydu/request.py +++ b/pydu/request.py @@ -1,16 +1,9 @@ import os import shutil import tempfile -from pydu.compat import PY2, string_types +from pydu.compat import string_types, ulib, urlparse from pydu.string import safeunicode -if PY2: - import urllib as ulib - import urlparse -else: - import urllib.request as ulib - import urllib.parse as urlparse - class FileName(object): @staticmethod