parse.py 1.0 KB

12345678910111213141516171819202122232425262728
  1. from __future__ import absolute_import
  2. from future.standard_library import suspend_hooks
  3. from future.utils import PY3
  4. if PY3:
  5. from urllib.parse import *
  6. else:
  7. __future_module__ = True
  8. from urlparse import (ParseResult, SplitResult, parse_qs, parse_qsl,
  9. urldefrag, urljoin, urlparse, urlsplit,
  10. urlunparse, urlunsplit)
  11. # we use this method to get at the original py2 urllib before any renaming
  12. # quote = sys.py2_modules['urllib'].quote
  13. # quote_plus = sys.py2_modules['urllib'].quote_plus
  14. # unquote = sys.py2_modules['urllib'].unquote
  15. # unquote_plus = sys.py2_modules['urllib'].unquote_plus
  16. # urlencode = sys.py2_modules['urllib'].urlencode
  17. # splitquery = sys.py2_modules['urllib'].splitquery
  18. with suspend_hooks():
  19. from urllib import (quote,
  20. quote_plus,
  21. unquote,
  22. unquote_plus,
  23. urlencode,
  24. splitquery)