request.py 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.request import *
  6. # This aren't in __all__:
  7. from urllib.request import (getproxies,
  8. pathname2url,
  9. proxy_bypass,
  10. quote,
  11. request_host,
  12. thishost,
  13. unquote,
  14. url2pathname,
  15. urlcleanup,
  16. urljoin,
  17. urlopen,
  18. urlparse,
  19. urlretrieve,
  20. urlsplit,
  21. urlunparse)
  22. from urllib.parse import (splitattr,
  23. splithost,
  24. splitpasswd,
  25. splitport,
  26. splitquery,
  27. splittag,
  28. splittype,
  29. splituser,
  30. splitvalue,
  31. to_bytes,
  32. unwrap)
  33. else:
  34. __future_module__ = True
  35. with suspend_hooks():
  36. from urllib import *
  37. from urllib2 import *
  38. from urlparse import *
  39. # Rename:
  40. from urllib import toBytes # missing from __all__ on Py2.6
  41. to_bytes = toBytes
  42. # from urllib import (pathname2url,
  43. # url2pathname,
  44. # getproxies,
  45. # urlretrieve,
  46. # urlcleanup,
  47. # URLopener,
  48. # FancyURLopener,
  49. # proxy_bypass)
  50. # from urllib2 import (
  51. # AbstractBasicAuthHandler,
  52. # AbstractDigestAuthHandler,
  53. # BaseHandler,
  54. # CacheFTPHandler,
  55. # FileHandler,
  56. # FTPHandler,
  57. # HTTPBasicAuthHandler,
  58. # HTTPCookieProcessor,
  59. # HTTPDefaultErrorHandler,
  60. # HTTPDigestAuthHandler,
  61. # HTTPErrorProcessor,
  62. # HTTPHandler,
  63. # HTTPPasswordMgr,
  64. # HTTPPasswordMgrWithDefaultRealm,
  65. # HTTPRedirectHandler,
  66. # HTTPSHandler,
  67. # URLError,
  68. # build_opener,
  69. # install_opener,
  70. # OpenerDirector,
  71. # ProxyBasicAuthHandler,
  72. # ProxyDigestAuthHandler,
  73. # ProxyHandler,
  74. # Request,
  75. # UnknownHandler,
  76. # urlopen,
  77. # )
  78. # from urlparse import (
  79. # urldefrag
  80. # urljoin,
  81. # urlparse,
  82. # urlunparse,
  83. # urlsplit,
  84. # urlunsplit,
  85. # parse_qs,
  86. # parse_q"
  87. # )