client.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. from __future__ import absolute_import
  2. import sys
  3. assert sys.version_info[0] < 3
  4. from httplib import *
  5. from httplib import HTTPMessage
  6. # These constants aren't included in __all__ in httplib.py:
  7. from httplib import (HTTP_PORT,
  8. HTTPS_PORT,
  9. CONTINUE,
  10. SWITCHING_PROTOCOLS,
  11. PROCESSING,
  12. OK,
  13. CREATED,
  14. ACCEPTED,
  15. NON_AUTHORITATIVE_INFORMATION,
  16. NO_CONTENT,
  17. RESET_CONTENT,
  18. PARTIAL_CONTENT,
  19. MULTI_STATUS,
  20. IM_USED,
  21. MULTIPLE_CHOICES,
  22. MOVED_PERMANENTLY,
  23. FOUND,
  24. SEE_OTHER,
  25. NOT_MODIFIED,
  26. USE_PROXY,
  27. TEMPORARY_REDIRECT,
  28. BAD_REQUEST,
  29. UNAUTHORIZED,
  30. PAYMENT_REQUIRED,
  31. FORBIDDEN,
  32. NOT_FOUND,
  33. METHOD_NOT_ALLOWED,
  34. NOT_ACCEPTABLE,
  35. PROXY_AUTHENTICATION_REQUIRED,
  36. REQUEST_TIMEOUT,
  37. CONFLICT,
  38. GONE,
  39. LENGTH_REQUIRED,
  40. PRECONDITION_FAILED,
  41. REQUEST_ENTITY_TOO_LARGE,
  42. REQUEST_URI_TOO_LONG,
  43. UNSUPPORTED_MEDIA_TYPE,
  44. REQUESTED_RANGE_NOT_SATISFIABLE,
  45. EXPECTATION_FAILED,
  46. UNPROCESSABLE_ENTITY,
  47. LOCKED,
  48. FAILED_DEPENDENCY,
  49. UPGRADE_REQUIRED,
  50. INTERNAL_SERVER_ERROR,
  51. NOT_IMPLEMENTED,
  52. BAD_GATEWAY,
  53. SERVICE_UNAVAILABLE,
  54. GATEWAY_TIMEOUT,
  55. HTTP_VERSION_NOT_SUPPORTED,
  56. INSUFFICIENT_STORAGE,
  57. NOT_EXTENDED,
  58. MAXAMOUNT,
  59. )
  60. # These are not available on Python 2.6.x:
  61. try:
  62. from httplib import LineTooLong, LineAndFileWrapper
  63. except ImportError:
  64. pass
  65. # These may not be available on all versions of Python 2.6.x or 2.7.x
  66. try:
  67. from httplib import (
  68. _CS_IDLE,
  69. _CS_REQ_STARTED,
  70. _CS_REQ_SENT,
  71. _MAXLINE,
  72. _MAXHEADERS,
  73. _is_legal_header_name,
  74. _is_illegal_header_value,
  75. _METHODS_EXPECTING_BODY
  76. )
  77. except ImportError:
  78. pass