com.googler.python 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/package.json +4 -2
  2. package/python3.4.2/lib/python3.4/site-packages/pip/__init__.py +1 -277
  3. package/python3.4.2/lib/python3.4/site-packages/pip/__main__.py +19 -7
  4. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/__init__.py +246 -0
  5. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/basecommand.py +373 -0
  6. package/python3.4.2/lib/python3.4/site-packages/pip/{baseparser.py → _internal/baseparser.py} +240 -224
  7. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/build_env.py +92 -0
  8. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cache.py +202 -0
  9. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/cmdoptions.py +609 -0
  10. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/__init__.py +79 -0
  11. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/check.py +42 -0
  12. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/completion.py +94 -0
  13. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/configuration.py +227 -0
  14. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/download.py +233 -0
  15. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/freeze.py +96 -0
  16. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/hash.py +57 -0
  17. package/python3.4.2/lib/python3.4/site-packages/pip/{commands → _internal/commands}/help.py +36 -33
  18. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/install.py +477 -0
  19. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/list.py +343 -0
  20. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/search.py +135 -0
  21. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/show.py +164 -0
  22. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/uninstall.py +71 -0
  23. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/commands/wheel.py +179 -0
  24. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/compat.py +235 -0
  25. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/configuration.py +378 -0
  26. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/download.py +922 -0
  27. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/exceptions.py +249 -0
  28. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/index.py +1117 -0
  29. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/locations.py +194 -0
  30. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/__init__.py +4 -0
  31. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/models/index.py +15 -0
  32. package/python3.4.2/lib/python3.4/site-packages/pip/{_vendor/requests/packages/urllib3/contrib → _internal/operations}/__init__.py +0 -0
  33. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/check.py +106 -0
  34. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/freeze.py +252 -0
  35. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/operations/prepare.py +378 -0
  36. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/pep425tags.py +317 -0
  37. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/__init__.py +69 -0
  38. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_file.py +338 -0
  39. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_install.py +1115 -0
  40. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_set.py +164 -0
  41. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/req/req_uninstall.py +455 -0
  42. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/resolve.py +354 -0
  43. package/python3.4.2/lib/python3.4/site-packages/pip/{status_codes.py → _internal/status_codes.py} +8 -6
  44. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/__init__.py +0 -0
  45. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/appdirs.py +258 -0
  46. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/deprecation.py +77 -0
  47. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/encoding.py +33 -0
  48. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/filesystem.py +28 -0
  49. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/glibc.py +84 -0
  50. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/hashes.py +94 -0
  51. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/logging.py +132 -0
  52. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/misc.py +851 -0
  53. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/outdated.py +163 -0
  54. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/packaging.py +70 -0
  55. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/setuptools_build.py +8 -0
  56. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/temp_dir.py +82 -0
  57. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/typing.py +29 -0
  58. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/utils/ui.py +421 -0
  59. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/__init__.py +471 -0
  60. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/bazaar.py +113 -0
  61. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/git.py +311 -0
  62. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/mercurial.py +105 -0
  63. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/vcs/subversion.py +271 -0
  64. package/python3.4.2/lib/python3.4/site-packages/pip/_internal/wheel.py +817 -0
  65. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/__init__.py +109 -8
  66. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/appdirs.py +604 -0
  67. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/__init__.py +11 -0
  68. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/_cmd.py +60 -0
  69. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/adapter.py +134 -0
  70. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/cache.py +39 -0
  71. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/__init__.py +2 -0
  72. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py +133 -0
  73. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py +43 -0
  74. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/compat.py +29 -0
  75. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/controller.py +373 -0
  76. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/filewrapper.py +78 -0
  77. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/heuristics.py +138 -0
  78. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/serialize.py +194 -0
  79. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/cachecontrol/wrapper.py +27 -0
  80. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__init__.py +3 -0
  81. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/__main__.py +2 -0
  82. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests → certifi}/cacert.pem +1765 -2358
  83. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/certifi/core.py +37 -0
  84. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/__init__.py +39 -32
  85. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/big5freq.py +386 -0
  86. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/big5prober.py +47 -42
  87. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/chardistribution.py +233 -231
  88. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetgroupprober.py +106 -0
  89. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/charsetprober.py +145 -0
  90. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/__init__.py +1 -0
  91. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/cli/chardetect.py +85 -0
  92. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/codingstatemachine.py +88 -0
  93. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/compat.py +34 -34
  94. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/cp949prober.py +49 -44
  95. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/enums.py +76 -0
  96. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escprober.py +101 -0
  97. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/escsm.py +246 -0
  98. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/eucjpprober.py +92 -0
  99. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/euckrfreq.py +195 -0
  100. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euckrprober.py +47 -42
  101. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwfreq.py +387 -428
  102. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/euctwprober.py +46 -41
  103. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312freq.py +283 -472
  104. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/gb2312prober.py +46 -41
  105. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/hebrewprober.py +292 -283
  106. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jisfreq.py +325 -569
  107. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/jpcntx.py +233 -219
  108. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langbulgarianmodel.py +228 -229
  109. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langcyrillicmodel.py +333 -329
  110. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langgreekmodel.py +225 -225
  111. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhebrewmodel.py +200 -201
  112. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langhungarianmodel.py +225 -225
  113. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/langthaimodel.py +199 -200
  114. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/langturkishmodel.py +193 -0
  115. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/latin1prober.py +145 -139
  116. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcharsetprober.py +91 -0
  117. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/mbcsgroupprober.py +54 -54
  118. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/mbcssm.py +572 -0
  119. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sbcharsetprober.py +132 -0
  120. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/sbcsgroupprober.py +73 -69
  121. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/sjisprober.py +92 -0
  122. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/universaldetector.py +286 -0
  123. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/chardet → chardet}/utf8prober.py +82 -76
  124. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/chardet/version.py +9 -0
  125. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/__init__.py +7 -7
  126. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansi.py +102 -50
  127. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/ansitowin32.py +236 -190
  128. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/initialise.py +82 -56
  129. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/win32.py +156 -137
  130. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/colorama/winterm.py +162 -120
  131. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/__init__.py +23 -23
  132. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/__init__.py +6 -6
  133. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/misc.py +41 -41
  134. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/shutil.py +761 -761
  135. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.cfg +84 -84
  136. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/sysconfig.py +788 -788
  137. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/_backport/tarfile.py +2607 -2607
  138. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/compat.py +1117 -1064
  139. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/database.py +1318 -1301
  140. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/index.py +516 -488
  141. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/locators.py +1292 -1194
  142. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/manifest.py +393 -364
  143. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/markers.py +131 -190
  144. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/metadata.py +1068 -1026
  145. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/resources.py +355 -317
  146. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/scripts.py +415 -323
  147. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t32.exe +0 -0
  148. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/t64.exe +0 -0
  149. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/util.py +1755 -1575
  150. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/version.py +736 -721
  151. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w32.exe +0 -0
  152. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/w64.exe +0 -0
  153. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distlib/wheel.py +984 -958
  154. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/distro.py +1104 -0
  155. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/__init__.py +35 -23
  156. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{ihatexml.py → _ihatexml.py} +288 -285
  157. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{inputstream.py → _inputstream.py} +923 -881
  158. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{tokenizer.py → _tokenizer.py} +1721 -1731
  159. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/__init__.py +14 -12
  160. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/_base.py +37 -37
  161. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/datrie.py +44 -44
  162. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{trie → _trie}/py.py +67 -67
  163. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/{utils.py → _utils.py} +124 -82
  164. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/constants.py +2947 -3104
  165. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/alphabeticalattributes.py +29 -20
  166. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/{_base.py → base.py} +12 -12
  167. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/inject_meta_charset.py +73 -65
  168. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/lint.py +93 -93
  169. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/optionaltags.py +207 -205
  170. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/sanitizer.py +896 -12
  171. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/filters/whitespace.py +38 -38
  172. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/html5parser.py +2791 -2713
  173. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer.py +409 -0
  174. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/__init__.py +30 -0
  175. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/genshi.py +54 -0
  176. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treeadapters/sax.py +50 -44
  177. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py +88 -76
  178. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/{_base.py → base.py} +417 -377
  179. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/dom.py +236 -227
  180. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree.py +340 -337
  181. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treebuilders/etree_lxml.py +366 -369
  182. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py +154 -57
  183. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{_base.py → base.py} +252 -200
  184. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/dom.py +43 -46
  185. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/etree.py +130 -138
  186. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{lxmletree.py → etree_lxml.py} +213 -208
  187. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/{genshistream.py → genshi.py} +69 -69
  188. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/__init__.py +2 -0
  189. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/codec.py +118 -0
  190. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/compat.py +12 -0
  191. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/core.py +387 -0
  192. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/idnadata.py +1585 -0
  193. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/intranges.py +53 -0
  194. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/package_data.py +2 -0
  195. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/idna/uts46data.py +7634 -0
  196. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/ipaddress.py +2419 -0
  197. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/__init__.py +347 -0
  198. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/linklockfile.py +73 -0
  199. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/mkdirlockfile.py +84 -0
  200. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/pidlockfile.py +190 -0
  201. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/sqlitelockfile.py +156 -0
  202. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py +70 -0
  203. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/__init__.py +66 -0
  204. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/_version.py +1 -0
  205. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/exceptions.py +41 -0
  206. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/msgpack/fallback.py +971 -0
  207. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__about__.py +21 -0
  208. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/__init__.py +14 -0
  209. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_compat.py +30 -0
  210. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/_structures.py +70 -0
  211. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/markers.py +301 -0
  212. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/requirements.py +130 -0
  213. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/specifiers.py +774 -0
  214. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/utils.py +63 -0
  215. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/packaging/version.py +441 -0
  216. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{pkg_resources.py → pkg_resources/__init__.py} +3125 -2762
  217. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources/py31compat.py +22 -0
  218. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/__init__.py +127 -0
  219. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/bar.py +88 -0
  220. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/counter.py +48 -0
  221. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/helpers.py +91 -0
  222. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/progress/spinner.py +44 -0
  223. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pyparsing.py +5720 -0
  224. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/__init__.py +3 -0
  225. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/core.py +13 -0
  226. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/parser.py +374 -0
  227. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/pytoml/writer.py +127 -0
  228. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__init__.py +123 -77
  229. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/__version__.py +14 -0
  230. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/_internal_utils.py +42 -0
  231. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py +525 -388
  232. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/api.py +152 -120
  233. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/auth.py +293 -193
  234. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/certs.py +18 -24
  235. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/compat.py +73 -115
  236. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/cookies.py +542 -454
  237. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/exceptions.py +122 -75
  238. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/help.py +120 -0
  239. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/hooks.py +34 -45
  240. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/models.py +948 -803
  241. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages.py +16 -0
  242. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py +737 -637
  243. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/status_codes.py +91 -88
  244. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/structures.py +105 -127
  245. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/utils.py +904 -673
  246. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/retrying.py +267 -0
  247. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/six.py +891 -646
  248. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/__init__.py +97 -0
  249. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/_collections.py +319 -0
  250. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/connection.py +373 -0
  251. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/connectionpool.py +905 -710
  252. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/__init__.py +0 -0
  253. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/__init__.py +0 -0
  254. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/bindings.py +593 -0
  255. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py +343 -0
  256. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/appengine.py +296 -0
  257. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/contrib/ntlmpool.py +112 -120
  258. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py +455 -0
  259. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/securetransport.py +810 -0
  260. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/contrib/socks.py +188 -0
  261. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/exceptions.py +246 -0
  262. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/fields.py +178 -177
  263. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/filepost.py +94 -100
  264. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/__init__.py +5 -4
  265. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/__init__.py +0 -0
  266. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py +53 -0
  267. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ordered_dict.py +259 -260
  268. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/packages/six.py +868 -0
  269. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/__init__.py +19 -13
  270. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/packages/ssl_match_hostname/_implementation.py +157 -105
  271. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/poolmanager.py +440 -0
  272. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/request.py +148 -141
  273. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/response.py +626 -0
  274. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/__init__.py +54 -0
  275. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/connection.py +130 -0
  276. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/request.py +118 -0
  277. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/response.py +81 -0
  278. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/retry.py +401 -0
  279. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/selectors.py +581 -0
  280. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/ssl_.py +341 -0
  281. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/timeout.py +242 -234
  282. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/{requests/packages/urllib3 → urllib3}/util/url.py +230 -162
  283. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/urllib3/util/wait.py +40 -0
  284. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/__init__.py +342 -0
  285. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/labels.py +231 -0
  286. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/mklabels.py +59 -0
  287. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/tests.py +153 -0
  288. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/webencodings/x_user_defined.py +325 -0
  289. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/__init__.py +0 -16
  290. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/_markerlib/markers.py +0 -119
  291. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/sanitizer.py +0 -271
  292. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/__init__.py +0 -16
  293. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/serializer/htmlserializer.py +0 -320
  294. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/html5lib/treewalkers/pulldom.py +0 -63
  295. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/re-vendor.py +0 -34
  296. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/__init__.py +0 -3
  297. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/big5freq.py +0 -925
  298. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/chardetect.py +0 -46
  299. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetgroupprober.py +0 -106
  300. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/charsetprober.py +0 -62
  301. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/codingstatemachine.py +0 -61
  302. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/constants.py +0 -39
  303. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escprober.py +0 -86
  304. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/escsm.py +0 -242
  305. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/eucjpprober.py +0 -90
  306. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py +0 -596
  307. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcharsetprober.py +0 -86
  308. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py +0 -575
  309. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py +0 -120
  310. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py +0 -91
  311. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/universaldetector.py +0 -170
  312. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py +0 -58
  313. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/_collections.py +0 -205
  314. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connection.py +0 -204
  315. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py +0 -422
  316. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/exceptions.py +0 -126
  317. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/packages/six.py +0 -385
  318. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py +0 -258
  319. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/response.py +0 -308
  320. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/__init__.py +0 -27
  321. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/connection.py +0 -45
  322. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py +0 -68
  323. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/response.py +0 -13
  324. package/python3.4.2/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py +0 -133
  325. package/python3.4.2/lib/python3.4/site-packages/pip/backwardcompat/__init__.py +0 -138
  326. package/python3.4.2/lib/python3.4/site-packages/pip/basecommand.py +0 -201
  327. package/python3.4.2/lib/python3.4/site-packages/pip/cmdoptions.py +0 -371
  328. package/python3.4.2/lib/python3.4/site-packages/pip/commands/__init__.py +0 -88
  329. package/python3.4.2/lib/python3.4/site-packages/pip/commands/bundle.py +0 -42
  330. package/python3.4.2/lib/python3.4/site-packages/pip/commands/completion.py +0 -59
  331. package/python3.4.2/lib/python3.4/site-packages/pip/commands/freeze.py +0 -114
  332. package/python3.4.2/lib/python3.4/site-packages/pip/commands/install.py +0 -314
  333. package/python3.4.2/lib/python3.4/site-packages/pip/commands/list.py +0 -162
  334. package/python3.4.2/lib/python3.4/site-packages/pip/commands/search.py +0 -132
  335. package/python3.4.2/lib/python3.4/site-packages/pip/commands/show.py +0 -80
  336. package/python3.4.2/lib/python3.4/site-packages/pip/commands/uninstall.py +0 -59
  337. package/python3.4.2/lib/python3.4/site-packages/pip/commands/unzip.py +0 -7
  338. package/python3.4.2/lib/python3.4/site-packages/pip/commands/wheel.py +0 -195
  339. package/python3.4.2/lib/python3.4/site-packages/pip/commands/zip.py +0 -351
  340. package/python3.4.2/lib/python3.4/site-packages/pip/download.py +0 -644
  341. package/python3.4.2/lib/python3.4/site-packages/pip/exceptions.py +0 -46
  342. package/python3.4.2/lib/python3.4/site-packages/pip/index.py +0 -990
  343. package/python3.4.2/lib/python3.4/site-packages/pip/locations.py +0 -171
  344. package/python3.4.2/lib/python3.4/site-packages/pip/log.py +0 -276
  345. package/python3.4.2/lib/python3.4/site-packages/pip/pep425tags.py +0 -102
  346. package/python3.4.2/lib/python3.4/site-packages/pip/req.py +0 -1931
  347. package/python3.4.2/lib/python3.4/site-packages/pip/runner.py +0 -18
  348. package/python3.4.2/lib/python3.4/site-packages/pip/util.py +0 -720
  349. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/__init__.py +0 -251
  350. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/bazaar.py +0 -131
  351. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/git.py +0 -194
  352. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/mercurial.py +0 -151
  353. package/python3.4.2/lib/python3.4/site-packages/pip/vcs/subversion.py +0 -273
  354. package/python3.4.2/lib/python3.4/site-packages/pip/wheel.py +0 -560
@@ -1,388 +1,525 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- """
4
- requests.adapters
5
- ~~~~~~~~~~~~~~~~~
6
-
7
- This module contains the transport adapters that Requests uses to define
8
- and maintain connections.
9
- """
10
-
11
- import socket
12
-
13
- from .models import Response
14
- from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
15
- from .packages.urllib3.response import HTTPResponse
16
- from .packages.urllib3.util import Timeout as TimeoutSauce
17
- from .compat import urlparse, basestring, urldefrag, unquote
18
- from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
19
- prepend_scheme_if_needed, get_auth_from_url)
20
- from .structures import CaseInsensitiveDict
21
- from .packages.urllib3.exceptions import MaxRetryError
22
- from .packages.urllib3.exceptions import TimeoutError
23
- from .packages.urllib3.exceptions import SSLError as _SSLError
24
- from .packages.urllib3.exceptions import HTTPError as _HTTPError
25
- from .packages.urllib3.exceptions import ProxyError as _ProxyError
26
- from .cookies import extract_cookies_to_jar
27
- from .exceptions import ConnectionError, Timeout, SSLError, ProxyError
28
- from .auth import _basic_auth_str
29
-
30
- DEFAULT_POOLBLOCK = False
31
- DEFAULT_POOLSIZE = 10
32
- DEFAULT_RETRIES = 0
33
-
34
-
35
- class BaseAdapter(object):
36
- """The Base Transport Adapter"""
37
-
38
- def __init__(self):
39
- super(BaseAdapter, self).__init__()
40
-
41
- def send(self):
42
- raise NotImplementedError
43
-
44
- def close(self):
45
- raise NotImplementedError
46
-
47
-
48
- class HTTPAdapter(BaseAdapter):
49
- """The built-in HTTP Adapter for urllib3.
50
-
51
- Provides a general-case interface for Requests sessions to contact HTTP and
52
- HTTPS urls by implementing the Transport Adapter interface. This class will
53
- usually be created by the :class:`Session <Session>` class under the
54
- covers.
55
-
56
- :param pool_connections: The number of urllib3 connection pools to cache.
57
- :param pool_maxsize: The maximum number of connections to save in the pool.
58
- :param int max_retries: The maximum number of retries each connection
59
- should attempt. Note, this applies only to failed connections and
60
- timeouts, never to requests where the server returns a response.
61
- :param pool_block: Whether the connection pool should block for connections.
62
-
63
- Usage::
64
-
65
- >>> import requests
66
- >>> s = requests.Session()
67
- >>> a = requests.adapters.HTTPAdapter(max_retries=3)
68
- >>> s.mount('http://', a)
69
- """
70
- __attrs__ = ['max_retries', 'config', '_pool_connections', '_pool_maxsize',
71
- '_pool_block']
72
-
73
- def __init__(self, pool_connections=DEFAULT_POOLSIZE,
74
- pool_maxsize=DEFAULT_POOLSIZE, max_retries=DEFAULT_RETRIES,
75
- pool_block=DEFAULT_POOLBLOCK):
76
- self.max_retries = max_retries
77
- self.config = {}
78
- self.proxy_manager = {}
79
-
80
- super(HTTPAdapter, self).__init__()
81
-
82
- self._pool_connections = pool_connections
83
- self._pool_maxsize = pool_maxsize
84
- self._pool_block = pool_block
85
-
86
- self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
87
-
88
- def __getstate__(self):
89
- return dict((attr, getattr(self, attr, None)) for attr in
90
- self.__attrs__)
91
-
92
- def __setstate__(self, state):
93
- # Can't handle by adding 'proxy_manager' to self.__attrs__ because
94
- # because self.poolmanager uses a lambda function, which isn't pickleable.
95
- self.proxy_manager = {}
96
- self.config = {}
97
-
98
- for attr, value in state.items():
99
- setattr(self, attr, value)
100
-
101
- self.init_poolmanager(self._pool_connections, self._pool_maxsize,
102
- block=self._pool_block)
103
-
104
- def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK):
105
- """Initializes a urllib3 PoolManager. This method should not be called
106
- from user code, and is only exposed for use when subclassing the
107
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
108
-
109
- :param connections: The number of urllib3 connection pools to cache.
110
- :param maxsize: The maximum number of connections to save in the pool.
111
- :param block: Block when no free connections are available.
112
- """
113
- # save these values for pickling
114
- self._pool_connections = connections
115
- self._pool_maxsize = maxsize
116
- self._pool_block = block
117
-
118
- self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize,
119
- block=block)
120
-
121
- def cert_verify(self, conn, url, verify, cert):
122
- """Verify a SSL certificate. This method should not be called from user
123
- code, and is only exposed for use when subclassing the
124
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
125
-
126
- :param conn: The urllib3 connection object associated with the cert.
127
- :param url: The requested URL.
128
- :param verify: Whether we should actually verify the certificate.
129
- :param cert: The SSL certificate to verify.
130
- """
131
- if url.lower().startswith('https') and verify:
132
-
133
- cert_loc = None
134
-
135
- # Allow self-specified cert location.
136
- if verify is not True:
137
- cert_loc = verify
138
-
139
- if not cert_loc:
140
- cert_loc = DEFAULT_CA_BUNDLE_PATH
141
-
142
- if not cert_loc:
143
- raise Exception("Could not find a suitable SSL CA certificate bundle.")
144
-
145
- conn.cert_reqs = 'CERT_REQUIRED'
146
- conn.ca_certs = cert_loc
147
- else:
148
- conn.cert_reqs = 'CERT_NONE'
149
- conn.ca_certs = None
150
-
151
- if cert:
152
- if not isinstance(cert, basestring):
153
- conn.cert_file = cert[0]
154
- conn.key_file = cert[1]
155
- else:
156
- conn.cert_file = cert
157
-
158
- def build_response(self, req, resp):
159
- """Builds a :class:`Response <requests.Response>` object from a urllib3
160
- response. This should not be called from user code, and is only exposed
161
- for use when subclassing the
162
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
163
-
164
- :param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
165
- :param resp: The urllib3 response object.
166
- """
167
- response = Response()
168
-
169
- # Fallback to None if there's no status_code, for whatever reason.
170
- response.status_code = getattr(resp, 'status', None)
171
-
172
- # Make headers case-insensitive.
173
- response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {}))
174
-
175
- # Set encoding.
176
- response.encoding = get_encoding_from_headers(response.headers)
177
- response.raw = resp
178
- response.reason = response.raw.reason
179
-
180
- if isinstance(req.url, bytes):
181
- response.url = req.url.decode('utf-8')
182
- else:
183
- response.url = req.url
184
-
185
- # Add new cookies from the server.
186
- extract_cookies_to_jar(response.cookies, req, resp)
187
-
188
- # Give the Response some context.
189
- response.request = req
190
- response.connection = self
191
-
192
- return response
193
-
194
- def get_connection(self, url, proxies=None):
195
- """Returns a urllib3 connection for the given URL. This should not be
196
- called from user code, and is only exposed for use when subclassing the
197
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
198
-
199
- :param url: The URL to connect to.
200
- :param proxies: (optional) A Requests-style dictionary of proxies used on this request.
201
- """
202
- proxies = proxies or {}
203
- proxy = proxies.get(urlparse(url.lower()).scheme)
204
-
205
- if proxy:
206
- proxy = prepend_scheme_if_needed(proxy, 'http')
207
- proxy_headers = self.proxy_headers(proxy)
208
-
209
- if not proxy in self.proxy_manager:
210
- self.proxy_manager[proxy] = proxy_from_url(
211
- proxy,
212
- proxy_headers=proxy_headers,
213
- num_pools=self._pool_connections,
214
- maxsize=self._pool_maxsize,
215
- block=self._pool_block)
216
-
217
- conn = self.proxy_manager[proxy].connection_from_url(url)
218
- else:
219
- # Only scheme should be lower case
220
- parsed = urlparse(url)
221
- url = parsed.geturl()
222
- conn = self.poolmanager.connection_from_url(url)
223
-
224
- return conn
225
-
226
- def close(self):
227
- """Disposes of any internal state.
228
-
229
- Currently, this just closes the PoolManager, which closes pooled
230
- connections.
231
- """
232
- self.poolmanager.clear()
233
-
234
- def request_url(self, request, proxies):
235
- """Obtain the url to use when making the final request.
236
-
237
- If the message is being sent through a HTTP proxy, the full URL has to
238
- be used. Otherwise, we should only use the path portion of the URL.
239
-
240
- This should not be called from user code, and is only exposed for use
241
- when subclassing the
242
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
243
-
244
- :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
245
- :param proxies: A dictionary of schemes to proxy URLs.
246
- """
247
- proxies = proxies or {}
248
- scheme = urlparse(request.url).scheme
249
- proxy = proxies.get(scheme)
250
-
251
- if proxy and scheme != 'https':
252
- url, _ = urldefrag(request.url)
253
- else:
254
- url = request.path_url
255
-
256
- return url
257
-
258
- def add_headers(self, request, **kwargs):
259
- """Add any headers needed by the connection. As of v2.0 this does
260
- nothing by default, but is left for overriding by users that subclass
261
- the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
262
-
263
- This should not be called from user code, and is only exposed for use
264
- when subclassing the
265
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
266
-
267
- :param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
268
- :param kwargs: The keyword arguments from the call to send().
269
- """
270
- pass
271
-
272
- def proxy_headers(self, proxy):
273
- """Returns a dictionary of the headers to add to any request sent
274
- through a proxy. This works with urllib3 magic to ensure that they are
275
- correctly sent to the proxy, rather than in a tunnelled request if
276
- CONNECT is being used.
277
-
278
- This should not be called from user code, and is only exposed for use
279
- when subclassing the
280
- :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
281
-
282
- :param proxies: The url of the proxy being used for this request.
283
- :param kwargs: Optional additional keyword arguments.
284
- """
285
- headers = {}
286
- username, password = get_auth_from_url(proxy)
287
-
288
- if username and password:
289
- headers['Proxy-Authorization'] = _basic_auth_str(username,
290
- password)
291
-
292
- return headers
293
-
294
- def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
295
- """Sends PreparedRequest object. Returns Response object.
296
-
297
- :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
298
- :param stream: (optional) Whether to stream the request content.
299
- :param timeout: (optional) The timeout on the request.
300
- :param verify: (optional) Whether to verify SSL certificates.
301
- :param cert: (optional) Any user-provided SSL certificate to be trusted.
302
- :param proxies: (optional) The proxies dictionary to apply to the request.
303
- """
304
-
305
- conn = self.get_connection(request.url, proxies)
306
-
307
- self.cert_verify(conn, request.url, verify, cert)
308
- url = self.request_url(request, proxies)
309
- self.add_headers(request)
310
-
311
- chunked = not (request.body is None or 'Content-Length' in request.headers)
312
-
313
- timeout = TimeoutSauce(connect=timeout, read=timeout)
314
-
315
- try:
316
- if not chunked:
317
- resp = conn.urlopen(
318
- method=request.method,
319
- url=url,
320
- body=request.body,
321
- headers=request.headers,
322
- redirect=False,
323
- assert_same_host=False,
324
- preload_content=False,
325
- decode_content=False,
326
- retries=self.max_retries,
327
- timeout=timeout
328
- )
329
-
330
- # Send the request.
331
- else:
332
- if hasattr(conn, 'proxy_pool'):
333
- conn = conn.proxy_pool
334
-
335
- low_conn = conn._get_conn(timeout=timeout)
336
-
337
- try:
338
- low_conn.putrequest(request.method,
339
- url,
340
- skip_accept_encoding=True)
341
-
342
- for header, value in request.headers.items():
343
- low_conn.putheader(header, value)
344
-
345
- low_conn.endheaders()
346
-
347
- for i in request.body:
348
- low_conn.send(hex(len(i))[2:].encode('utf-8'))
349
- low_conn.send(b'\r\n')
350
- low_conn.send(i)
351
- low_conn.send(b'\r\n')
352
- low_conn.send(b'0\r\n\r\n')
353
-
354
- r = low_conn.getresponse()
355
- resp = HTTPResponse.from_httplib(
356
- r,
357
- pool=conn,
358
- connection=low_conn,
359
- preload_content=False,
360
- decode_content=False
361
- )
362
- except:
363
- # If we hit any problems here, clean up the connection.
364
- # Then, reraise so that we can handle the actual exception.
365
- low_conn.close()
366
- raise
367
- else:
368
- # All is well, return the connection to the pool.
369
- conn._put_conn(low_conn)
370
-
371
- except socket.error as sockerr:
372
- raise ConnectionError(sockerr, request=request)
373
-
374
- except MaxRetryError as e:
375
- raise ConnectionError(e, request=request)
376
-
377
- except _ProxyError as e:
378
- raise ProxyError(e)
379
-
380
- except (_SSLError, _HTTPError) as e:
381
- if isinstance(e, _SSLError):
382
- raise SSLError(e, request=request)
383
- elif isinstance(e, TimeoutError):
384
- raise Timeout(e, request=request)
385
- else:
386
- raise
387
-
388
- return self.build_response(request, resp)
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ requests.adapters
5
+ ~~~~~~~~~~~~~~~~~
6
+
7
+ This module contains the transport adapters that Requests uses to define
8
+ and maintain connections.
9
+ """
10
+
11
+ import os.path
12
+ import socket
13
+
14
+ from pip._vendor.urllib3.poolmanager import PoolManager, proxy_from_url
15
+ from pip._vendor.urllib3.response import HTTPResponse
16
+ from pip._vendor.urllib3.util import Timeout as TimeoutSauce
17
+ from pip._vendor.urllib3.util.retry import Retry
18
+ from pip._vendor.urllib3.exceptions import ClosedPoolError
19
+ from pip._vendor.urllib3.exceptions import ConnectTimeoutError
20
+ from pip._vendor.urllib3.exceptions import HTTPError as _HTTPError
21
+ from pip._vendor.urllib3.exceptions import MaxRetryError
22
+ from pip._vendor.urllib3.exceptions import NewConnectionError
23
+ from pip._vendor.urllib3.exceptions import ProxyError as _ProxyError
24
+ from pip._vendor.urllib3.exceptions import ProtocolError
25
+ from pip._vendor.urllib3.exceptions import ReadTimeoutError
26
+ from pip._vendor.urllib3.exceptions import SSLError as _SSLError
27
+ from pip._vendor.urllib3.exceptions import ResponseError
28
+
29
+ from .models import Response
30
+ from .compat import urlparse, basestring
31
+ from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
32
+ prepend_scheme_if_needed, get_auth_from_url, urldefragauth,
33
+ select_proxy)
34
+ from .structures import CaseInsensitiveDict
35
+ from .cookies import extract_cookies_to_jar
36
+ from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, SSLError,
37
+ ProxyError, RetryError, InvalidSchema)
38
+ from .auth import _basic_auth_str
39
+
40
+ try:
41
+ from pip._vendor.urllib3.contrib.socks import SOCKSProxyManager
42
+ except ImportError:
43
+ def SOCKSProxyManager(*args, **kwargs):
44
+ raise InvalidSchema("Missing dependencies for SOCKS support.")
45
+
46
+ DEFAULT_POOLBLOCK = False
47
+ DEFAULT_POOLSIZE = 10
48
+ DEFAULT_RETRIES = 0
49
+ DEFAULT_POOL_TIMEOUT = None
50
+
51
+
52
+ class BaseAdapter(object):
53
+ """The Base Transport Adapter"""
54
+
55
+ def __init__(self):
56
+ super(BaseAdapter, self).__init__()
57
+
58
+ def send(self, request, stream=False, timeout=None, verify=True,
59
+ cert=None, proxies=None):
60
+ """Sends PreparedRequest object. Returns Response object.
61
+
62
+ :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
63
+ :param stream: (optional) Whether to stream the request content.
64
+ :param timeout: (optional) How long to wait for the server to send
65
+ data before giving up, as a float, or a :ref:`(connect timeout,
66
+ read timeout) <timeouts>` tuple.
67
+ :type timeout: float or tuple
68
+ :param verify: (optional) Either a boolean, in which case it controls whether we verify
69
+ the server's TLS certificate, or a string, in which case it must be a path
70
+ to a CA bundle to use
71
+ :param cert: (optional) Any user-provided SSL certificate to be trusted.
72
+ :param proxies: (optional) The proxies dictionary to apply to the request.
73
+ """
74
+ raise NotImplementedError
75
+
76
+ def close(self):
77
+ """Cleans up adapter specific items."""
78
+ raise NotImplementedError
79
+
80
+
81
+ class HTTPAdapter(BaseAdapter):
82
+ """The built-in HTTP Adapter for urllib3.
83
+
84
+ Provides a general-case interface for Requests sessions to contact HTTP and
85
+ HTTPS urls by implementing the Transport Adapter interface. This class will
86
+ usually be created by the :class:`Session <Session>` class under the
87
+ covers.
88
+
89
+ :param pool_connections: The number of urllib3 connection pools to cache.
90
+ :param pool_maxsize: The maximum number of connections to save in the pool.
91
+ :param max_retries: The maximum number of retries each connection
92
+ should attempt. Note, this applies only to failed DNS lookups, socket
93
+ connections and connection timeouts, never to requests where data has
94
+ made it to the server. By default, Requests does not retry failed
95
+ connections. If you need granular control over the conditions under
96
+ which we retry a request, import urllib3's ``Retry`` class and pass
97
+ that instead.
98
+ :param pool_block: Whether the connection pool should block for connections.
99
+
100
+ Usage::
101
+
102
+ >>> import requests
103
+ >>> s = requests.Session()
104
+ >>> a = requests.adapters.HTTPAdapter(max_retries=3)
105
+ >>> s.mount('http://', a)
106
+ """
107
+ __attrs__ = ['max_retries', 'config', '_pool_connections', '_pool_maxsize',
108
+ '_pool_block']
109
+
110
+ def __init__(self, pool_connections=DEFAULT_POOLSIZE,
111
+ pool_maxsize=DEFAULT_POOLSIZE, max_retries=DEFAULT_RETRIES,
112
+ pool_block=DEFAULT_POOLBLOCK):
113
+ if max_retries == DEFAULT_RETRIES:
114
+ self.max_retries = Retry(0, read=False)
115
+ else:
116
+ self.max_retries = Retry.from_int(max_retries)
117
+ self.config = {}
118
+ self.proxy_manager = {}
119
+
120
+ super(HTTPAdapter, self).__init__()
121
+
122
+ self._pool_connections = pool_connections
123
+ self._pool_maxsize = pool_maxsize
124
+ self._pool_block = pool_block
125
+
126
+ self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
127
+
128
+ def __getstate__(self):
129
+ return dict((attr, getattr(self, attr, None)) for attr in
130
+ self.__attrs__)
131
+
132
+ def __setstate__(self, state):
133
+ # Can't handle by adding 'proxy_manager' to self.__attrs__ because
134
+ # self.poolmanager uses a lambda function, which isn't pickleable.
135
+ self.proxy_manager = {}
136
+ self.config = {}
137
+
138
+ for attr, value in state.items():
139
+ setattr(self, attr, value)
140
+
141
+ self.init_poolmanager(self._pool_connections, self._pool_maxsize,
142
+ block=self._pool_block)
143
+
144
+ def init_poolmanager(self, connections, maxsize, block=DEFAULT_POOLBLOCK, **pool_kwargs):
145
+ """Initializes a urllib3 PoolManager.
146
+
147
+ This method should not be called from user code, and is only
148
+ exposed for use when subclassing the
149
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
150
+
151
+ :param connections: The number of urllib3 connection pools to cache.
152
+ :param maxsize: The maximum number of connections to save in the pool.
153
+ :param block: Block when no free connections are available.
154
+ :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
155
+ """
156
+ # save these values for pickling
157
+ self._pool_connections = connections
158
+ self._pool_maxsize = maxsize
159
+ self._pool_block = block
160
+
161
+ self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize,
162
+ block=block, strict=True, **pool_kwargs)
163
+
164
+ def proxy_manager_for(self, proxy, **proxy_kwargs):
165
+ """Return urllib3 ProxyManager for the given proxy.
166
+
167
+ This method should not be called from user code, and is only
168
+ exposed for use when subclassing the
169
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
170
+
171
+ :param proxy: The proxy to return a urllib3 ProxyManager for.
172
+ :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
173
+ :returns: ProxyManager
174
+ :rtype: urllib3.ProxyManager
175
+ """
176
+ if proxy in self.proxy_manager:
177
+ manager = self.proxy_manager[proxy]
178
+ elif proxy.lower().startswith('socks'):
179
+ username, password = get_auth_from_url(proxy)
180
+ manager = self.proxy_manager[proxy] = SOCKSProxyManager(
181
+ proxy,
182
+ username=username,
183
+ password=password,
184
+ num_pools=self._pool_connections,
185
+ maxsize=self._pool_maxsize,
186
+ block=self._pool_block,
187
+ **proxy_kwargs
188
+ )
189
+ else:
190
+ proxy_headers = self.proxy_headers(proxy)
191
+ manager = self.proxy_manager[proxy] = proxy_from_url(
192
+ proxy,
193
+ proxy_headers=proxy_headers,
194
+ num_pools=self._pool_connections,
195
+ maxsize=self._pool_maxsize,
196
+ block=self._pool_block,
197
+ **proxy_kwargs)
198
+
199
+ return manager
200
+
201
+ def cert_verify(self, conn, url, verify, cert):
202
+ """Verify a SSL certificate. This method should not be called from user
203
+ code, and is only exposed for use when subclassing the
204
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
205
+
206
+ :param conn: The urllib3 connection object associated with the cert.
207
+ :param url: The requested URL.
208
+ :param verify: Either a boolean, in which case it controls whether we verify
209
+ the server's TLS certificate, or a string, in which case it must be a path
210
+ to a CA bundle to use
211
+ :param cert: The SSL certificate to verify.
212
+ """
213
+ if url.lower().startswith('https') and verify:
214
+
215
+ cert_loc = None
216
+
217
+ # Allow self-specified cert location.
218
+ if verify is not True:
219
+ cert_loc = verify
220
+
221
+ if not cert_loc:
222
+ cert_loc = DEFAULT_CA_BUNDLE_PATH
223
+
224
+ if not cert_loc or not os.path.exists(cert_loc):
225
+ raise IOError("Could not find a suitable TLS CA certificate bundle, "
226
+ "invalid path: {0}".format(cert_loc))
227
+
228
+ conn.cert_reqs = 'CERT_REQUIRED'
229
+
230
+ if not os.path.isdir(cert_loc):
231
+ conn.ca_certs = cert_loc
232
+ else:
233
+ conn.ca_cert_dir = cert_loc
234
+ else:
235
+ conn.cert_reqs = 'CERT_NONE'
236
+ conn.ca_certs = None
237
+ conn.ca_cert_dir = None
238
+
239
+ if cert:
240
+ if not isinstance(cert, basestring):
241
+ conn.cert_file = cert[0]
242
+ conn.key_file = cert[1]
243
+ else:
244
+ conn.cert_file = cert
245
+ conn.key_file = None
246
+ if conn.cert_file and not os.path.exists(conn.cert_file):
247
+ raise IOError("Could not find the TLS certificate file, "
248
+ "invalid path: {0}".format(conn.cert_file))
249
+ if conn.key_file and not os.path.exists(conn.key_file):
250
+ raise IOError("Could not find the TLS key file, "
251
+ "invalid path: {0}".format(conn.key_file))
252
+
253
+ def build_response(self, req, resp):
254
+ """Builds a :class:`Response <requests.Response>` object from a urllib3
255
+ response. This should not be called from user code, and is only exposed
256
+ for use when subclassing the
257
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`
258
+
259
+ :param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
260
+ :param resp: The urllib3 response object.
261
+ :rtype: requests.Response
262
+ """
263
+ response = Response()
264
+
265
+ # Fallback to None if there's no status_code, for whatever reason.
266
+ response.status_code = getattr(resp, 'status', None)
267
+
268
+ # Make headers case-insensitive.
269
+ response.headers = CaseInsensitiveDict(getattr(resp, 'headers', {}))
270
+
271
+ # Set encoding.
272
+ response.encoding = get_encoding_from_headers(response.headers)
273
+ response.raw = resp
274
+ response.reason = response.raw.reason
275
+
276
+ if isinstance(req.url, bytes):
277
+ response.url = req.url.decode('utf-8')
278
+ else:
279
+ response.url = req.url
280
+
281
+ # Add new cookies from the server.
282
+ extract_cookies_to_jar(response.cookies, req, resp)
283
+
284
+ # Give the Response some context.
285
+ response.request = req
286
+ response.connection = self
287
+
288
+ return response
289
+
290
+ def get_connection(self, url, proxies=None):
291
+ """Returns a urllib3 connection for the given URL. This should not be
292
+ called from user code, and is only exposed for use when subclassing the
293
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
294
+
295
+ :param url: The URL to connect to.
296
+ :param proxies: (optional) A Requests-style dictionary of proxies used on this request.
297
+ :rtype: urllib3.ConnectionPool
298
+ """
299
+ proxy = select_proxy(url, proxies)
300
+
301
+ if proxy:
302
+ proxy = prepend_scheme_if_needed(proxy, 'http')
303
+ proxy_manager = self.proxy_manager_for(proxy)
304
+ conn = proxy_manager.connection_from_url(url)
305
+ else:
306
+ # Only scheme should be lower case
307
+ parsed = urlparse(url)
308
+ url = parsed.geturl()
309
+ conn = self.poolmanager.connection_from_url(url)
310
+
311
+ return conn
312
+
313
+ def close(self):
314
+ """Disposes of any internal state.
315
+
316
+ Currently, this closes the PoolManager and any active ProxyManager,
317
+ which closes any pooled connections.
318
+ """
319
+ self.poolmanager.clear()
320
+ for proxy in self.proxy_manager.values():
321
+ proxy.clear()
322
+
323
+ def request_url(self, request, proxies):
324
+ """Obtain the url to use when making the final request.
325
+
326
+ If the message is being sent through a HTTP proxy, the full URL has to
327
+ be used. Otherwise, we should only use the path portion of the URL.
328
+
329
+ This should not be called from user code, and is only exposed for use
330
+ when subclassing the
331
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
332
+
333
+ :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
334
+ :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
335
+ :rtype: str
336
+ """
337
+ proxy = select_proxy(request.url, proxies)
338
+ scheme = urlparse(request.url).scheme
339
+
340
+ is_proxied_http_request = (proxy and scheme != 'https')
341
+ using_socks_proxy = False
342
+ if proxy:
343
+ proxy_scheme = urlparse(proxy).scheme.lower()
344
+ using_socks_proxy = proxy_scheme.startswith('socks')
345
+
346
+ url = request.path_url
347
+ if is_proxied_http_request and not using_socks_proxy:
348
+ url = urldefragauth(request.url)
349
+
350
+ return url
351
+
352
+ def add_headers(self, request, **kwargs):
353
+ """Add any headers needed by the connection. As of v2.0 this does
354
+ nothing by default, but is left for overriding by users that subclass
355
+ the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
356
+
357
+ This should not be called from user code, and is only exposed for use
358
+ when subclassing the
359
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
360
+
361
+ :param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
362
+ :param kwargs: The keyword arguments from the call to send().
363
+ """
364
+ pass
365
+
366
+ def proxy_headers(self, proxy):
367
+ """Returns a dictionary of the headers to add to any request sent
368
+ through a proxy. This works with urllib3 magic to ensure that they are
369
+ correctly sent to the proxy, rather than in a tunnelled request if
370
+ CONNECT is being used.
371
+
372
+ This should not be called from user code, and is only exposed for use
373
+ when subclassing the
374
+ :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
375
+
376
+ :param proxies: The url of the proxy being used for this request.
377
+ :rtype: dict
378
+ """
379
+ headers = {}
380
+ username, password = get_auth_from_url(proxy)
381
+
382
+ if username:
383
+ headers['Proxy-Authorization'] = _basic_auth_str(username,
384
+ password)
385
+
386
+ return headers
387
+
388
+ def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
389
+ """Sends PreparedRequest object. Returns Response object.
390
+
391
+ :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
392
+ :param stream: (optional) Whether to stream the request content.
393
+ :param timeout: (optional) How long to wait for the server to send
394
+ data before giving up, as a float, or a :ref:`(connect timeout,
395
+ read timeout) <timeouts>` tuple.
396
+ :type timeout: float or tuple or urllib3 Timeout object
397
+ :param verify: (optional) Either a boolean, in which case it controls whether
398
+ we verify the server's TLS certificate, or a string, in which case it
399
+ must be a path to a CA bundle to use
400
+ :param cert: (optional) Any user-provided SSL certificate to be trusted.
401
+ :param proxies: (optional) The proxies dictionary to apply to the request.
402
+ :rtype: requests.Response
403
+ """
404
+
405
+ conn = self.get_connection(request.url, proxies)
406
+
407
+ self.cert_verify(conn, request.url, verify, cert)
408
+ url = self.request_url(request, proxies)
409
+ self.add_headers(request)
410
+
411
+ chunked = not (request.body is None or 'Content-Length' in request.headers)
412
+
413
+ if isinstance(timeout, tuple):
414
+ try:
415
+ connect, read = timeout
416
+ timeout = TimeoutSauce(connect=connect, read=read)
417
+ except ValueError as e:
418
+ # this may raise a string formatting error.
419
+ err = ("Invalid timeout {0}. Pass a (connect, read) "
420
+ "timeout tuple, or a single float to set "
421
+ "both timeouts to the same value".format(timeout))
422
+ raise ValueError(err)
423
+ elif isinstance(timeout, TimeoutSauce):
424
+ pass
425
+ else:
426
+ timeout = TimeoutSauce(connect=timeout, read=timeout)
427
+
428
+ try:
429
+ if not chunked:
430
+ resp = conn.urlopen(
431
+ method=request.method,
432
+ url=url,
433
+ body=request.body,
434
+ headers=request.headers,
435
+ redirect=False,
436
+ assert_same_host=False,
437
+ preload_content=False,
438
+ decode_content=False,
439
+ retries=self.max_retries,
440
+ timeout=timeout
441
+ )
442
+
443
+ # Send the request.
444
+ else:
445
+ if hasattr(conn, 'proxy_pool'):
446
+ conn = conn.proxy_pool
447
+
448
+ low_conn = conn._get_conn(timeout=DEFAULT_POOL_TIMEOUT)
449
+
450
+ try:
451
+ low_conn.putrequest(request.method,
452
+ url,
453
+ skip_accept_encoding=True)
454
+
455
+ for header, value in request.headers.items():
456
+ low_conn.putheader(header, value)
457
+
458
+ low_conn.endheaders()
459
+
460
+ for i in request.body:
461
+ low_conn.send(hex(len(i))[2:].encode('utf-8'))
462
+ low_conn.send(b'\r\n')
463
+ low_conn.send(i)
464
+ low_conn.send(b'\r\n')
465
+ low_conn.send(b'0\r\n\r\n')
466
+
467
+ # Receive the response from the server
468
+ try:
469
+ # For Python 2.7+ versions, use buffering of HTTP
470
+ # responses
471
+ r = low_conn.getresponse(buffering=True)
472
+ except TypeError:
473
+ # For compatibility with Python 2.6 versions and back
474
+ r = low_conn.getresponse()
475
+
476
+ resp = HTTPResponse.from_httplib(
477
+ r,
478
+ pool=conn,
479
+ connection=low_conn,
480
+ preload_content=False,
481
+ decode_content=False
482
+ )
483
+ except:
484
+ # If we hit any problems here, clean up the connection.
485
+ # Then, reraise so that we can handle the actual exception.
486
+ low_conn.close()
487
+ raise
488
+
489
+ except (ProtocolError, socket.error) as err:
490
+ raise ConnectionError(err, request=request)
491
+
492
+ except MaxRetryError as e:
493
+ if isinstance(e.reason, ConnectTimeoutError):
494
+ # TODO: Remove this in 3.0.0: see #2811
495
+ if not isinstance(e.reason, NewConnectionError):
496
+ raise ConnectTimeout(e, request=request)
497
+
498
+ if isinstance(e.reason, ResponseError):
499
+ raise RetryError(e, request=request)
500
+
501
+ if isinstance(e.reason, _ProxyError):
502
+ raise ProxyError(e, request=request)
503
+
504
+ if isinstance(e.reason, _SSLError):
505
+ # This branch is for urllib3 v1.22 and later.
506
+ raise SSLError(e, request=request)
507
+
508
+ raise ConnectionError(e, request=request)
509
+
510
+ except ClosedPoolError as e:
511
+ raise ConnectionError(e, request=request)
512
+
513
+ except _ProxyError as e:
514
+ raise ProxyError(e)
515
+
516
+ except (_SSLError, _HTTPError) as e:
517
+ if isinstance(e, _SSLError):
518
+ # This branch is for urllib3 versions earlier than v1.22
519
+ raise SSLError(e, request=request)
520
+ elif isinstance(e, ReadTimeoutError):
521
+ raise ReadTimeout(e, request=request)
522
+ else:
523
+ raise
524
+
525
+ return self.build_response(request, resp)