gcloud 0.0.7 → 0.1.0

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 (998) hide show
  1. checksums.yaml +7 -0
  2. data/{packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/ext/__init__.py → .gemtest} +0 -0
  3. data/.rubocop.yml +17 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CONTRIBUTING.md +93 -0
  6. data/LICENSE +201 -674
  7. data/Manifest.txt +66 -0
  8. data/README.md +110 -12
  9. data/Rakefile +34 -3
  10. data/gcloud.gemspec +48 -17
  11. data/lib/gcloud.rb +8 -0
  12. data/lib/gcloud/backoff.rb +115 -0
  13. data/lib/gcloud/credentials.rb +124 -0
  14. data/lib/gcloud/datastore.rb +66 -0
  15. data/lib/gcloud/datastore/connection.rb +177 -0
  16. data/lib/gcloud/datastore/credentials.rb +41 -0
  17. data/lib/gcloud/datastore/dataset.rb +259 -0
  18. data/lib/gcloud/datastore/dataset/lookup_results.rb +60 -0
  19. data/lib/gcloud/datastore/dataset/query_results.rb +87 -0
  20. data/lib/gcloud/datastore/entity.rb +257 -0
  21. data/lib/gcloud/datastore/errors.rb +65 -0
  22. data/lib/gcloud/datastore/key.rb +151 -0
  23. data/lib/gcloud/datastore/properties.rb +102 -0
  24. data/lib/gcloud/datastore/proto.rb +253 -0
  25. data/lib/gcloud/datastore/query.rb +189 -0
  26. data/lib/gcloud/datastore/transaction.rb +116 -0
  27. data/lib/gcloud/proto/datastore_v1.pb.rb +377 -0
  28. data/lib/gcloud/storage.rb +78 -0
  29. data/lib/gcloud/storage/bucket.rb +254 -0
  30. data/lib/gcloud/storage/bucket/acl.rb +311 -0
  31. data/lib/gcloud/storage/bucket/list.rb +45 -0
  32. data/lib/gcloud/storage/connection.rb +358 -0
  33. data/{packages/gsutil/gslib/commands/__init__.py → lib/gcloud/storage/credentials.rb} +13 -2
  34. data/lib/gcloud/storage/errors.rb +78 -0
  35. data/lib/gcloud/storage/file.rb +287 -0
  36. data/lib/gcloud/storage/file/acl.rb +172 -0
  37. data/lib/gcloud/storage/file/list.rb +52 -0
  38. data/lib/gcloud/storage/file/verifier.rb +65 -0
  39. data/lib/gcloud/storage/project.rb +119 -0
  40. data/lib/gcloud/version.rb +5 -0
  41. data/{packages/gsutil/gslib/tests/testcase/__init__.py → rakelib/console.rake} +14 -4
  42. data/{packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version.py → rakelib/manifest.rake} +11 -4
  43. data/{packages/gsutil/gslib/addlhelp/__init__.py → rakelib/proto.rake} +4 -2
  44. data/{packages/gsutil/gslib/tests/__init__.py → rakelib/rubocop.rake} +4 -2
  45. data/rakelib/test.rake +144 -0
  46. data/test/gcloud/datastore/proto/test_cursor.rb +36 -0
  47. data/test/gcloud/datastore/proto/test_direction.rb +60 -0
  48. data/test/gcloud/datastore/proto/test_operator.rb +76 -0
  49. data/test/gcloud/datastore/proto/test_value.rb +231 -0
  50. data/test/gcloud/datastore/test_connection.rb +93 -0
  51. data/test/gcloud/datastore/test_credentials.rb +38 -0
  52. data/test/gcloud/datastore/test_dataset.rb +413 -0
  53. data/test/gcloud/datastore/test_entity.rb +161 -0
  54. data/test/gcloud/datastore/test_entity_exclude.rb +225 -0
  55. data/test/gcloud/datastore/test_key.rb +189 -0
  56. data/test/gcloud/datastore/test_query.rb +271 -0
  57. data/test/gcloud/datastore/test_transaction.rb +121 -0
  58. data/test/gcloud/storage/test_backoff.rb +127 -0
  59. data/test/gcloud/storage/test_bucket.rb +270 -0
  60. data/test/gcloud/storage/test_bucket_acl.rb +253 -0
  61. data/test/gcloud/storage/test_default_acl.rb +256 -0
  62. data/test/gcloud/storage/test_file.rb +221 -0
  63. data/test/gcloud/storage/test_file_acl.rb +367 -0
  64. data/test/gcloud/storage/test_project.rb +180 -0
  65. data/{packages/gsutil/gslib/no_op_auth_plugin.py → test/gcloud/storage/test_storage.rb} +14 -15
  66. data/test/gcloud/storage/test_verifier.rb +62 -0
  67. data/test/gcloud/test_version.rb +8 -0
  68. data/test/helper.rb +91 -0
  69. metadata +259 -1020
  70. data.tar.gz.sig +0 -2
  71. data/CHANGELOG +0 -14
  72. data/Makefile +0 -13
  73. data/Manifest +0 -937
  74. data/TODO +0 -2
  75. data/bin/gcloud +0 -7
  76. data/bin/gcutil-symlink +0 -53
  77. data/bin/gsutil-symlink +0 -377
  78. data/init.rb +0 -3
  79. data/packages/README +0 -6
  80. data/packages/gcutil-1.7.1.tar.gz +0 -0
  81. data/packages/gcutil-1.7.1/CHANGELOG +0 -197
  82. data/packages/gcutil-1.7.1/LICENSE +0 -202
  83. data/packages/gcutil-1.7.1/VERSION +0 -1
  84. data/packages/gcutil-1.7.1/gcutil +0 -53
  85. data/packages/gcutil-1.7.1/lib/google_api_python_client/LICENSE +0 -23
  86. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/__init__.py +0 -1
  87. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/__init__.pyc +0 -0
  88. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/discovery.py +0 -743
  89. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/discovery.pyc +0 -0
  90. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/errors.py +0 -123
  91. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/errors.pyc +0 -0
  92. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/http.py +0 -1443
  93. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/http.pyc +0 -0
  94. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/mimeparse.py +0 -172
  95. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/mimeparse.pyc +0 -0
  96. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/model.py +0 -385
  97. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/model.pyc +0 -0
  98. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/schema.py +0 -303
  99. data/packages/gcutil-1.7.1/lib/google_api_python_client/apiclient/schema.pyc +0 -0
  100. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/__init__.py +0 -1
  101. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/__init__.pyc +0 -0
  102. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/anyjson.py +0 -32
  103. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/anyjson.pyc +0 -0
  104. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/appengine.py +0 -528
  105. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/client.py +0 -1139
  106. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/client.pyc +0 -0
  107. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/clientsecrets.py +0 -105
  108. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/clientsecrets.pyc +0 -0
  109. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/crypt.py +0 -244
  110. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/crypt.pyc +0 -0
  111. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/django_orm.py +0 -124
  112. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/file.py +0 -107
  113. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/locked_file.py +0 -343
  114. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/locked_file.pyc +0 -0
  115. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/multistore_file.py +0 -379
  116. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/multistore_file.pyc +0 -0
  117. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/tools.py +0 -174
  118. data/packages/gcutil-1.7.1/lib/google_api_python_client/oauth2client/tools.pyc +0 -0
  119. data/packages/gcutil-1.7.1/lib/google_api_python_client/uritemplate/__init__.py +0 -147
  120. data/packages/gcutil-1.7.1/lib/google_api_python_client/uritemplate/__init__.pyc +0 -0
  121. data/packages/gcutil-1.7.1/lib/google_apputils/LICENSE +0 -202
  122. data/packages/gcutil-1.7.1/lib/google_apputils/google/__init__.py +0 -3
  123. data/packages/gcutil-1.7.1/lib/google_apputils/google/__init__.pyc +0 -0
  124. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/__init__.py +0 -3
  125. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/__init__.pyc +0 -0
  126. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/app.py +0 -356
  127. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/app.pyc +0 -0
  128. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/appcommands.py +0 -783
  129. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/appcommands.pyc +0 -0
  130. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/basetest.py +0 -1260
  131. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/datelib.py +0 -421
  132. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/debug.py +0 -60
  133. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/file_util.py +0 -181
  134. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/resources.py +0 -67
  135. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/run_script_module.py +0 -217
  136. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/setup_command.py +0 -159
  137. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/shellutil.py +0 -49
  138. data/packages/gcutil-1.7.1/lib/google_apputils/google/apputils/stopwatch.py +0 -204
  139. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/__init__.py +0 -0
  140. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/__init__.pyc +0 -0
  141. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper.py +0 -140
  142. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper.pyc +0 -0
  143. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auth_helper_test.py +0 -149
  144. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth.py +0 -130
  145. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth.pyc +0 -0
  146. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/auto_auth_test.py +0 -75
  147. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds.py +0 -128
  148. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds.pyc +0 -0
  149. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/basic_cmds_test.py +0 -111
  150. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base.py +0 -1808
  151. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base.pyc +0 -0
  152. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/command_base_test.py +0 -1651
  153. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/compute/v1beta13.json +0 -2851
  154. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/compute/v1beta14.json +0 -3361
  155. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds.py +0 -342
  156. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds.pyc +0 -0
  157. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/disk_cmds_test.py +0 -474
  158. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds.py +0 -344
  159. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds.pyc +0 -0
  160. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/firewall_cmds_test.py +0 -231
  161. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/flags_cache.py +0 -274
  162. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/flags_cache.pyc +0 -0
  163. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil +0 -89
  164. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil_logging.py +0 -69
  165. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/gcutil_logging.pyc +0 -0
  166. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds.py +0 -262
  167. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds.pyc +0 -0
  168. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/image_cmds_test.py +0 -172
  169. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.py +0 -1506
  170. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds.pyc +0 -0
  171. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/instance_cmds_test.py +0 -1904
  172. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds.py +0 -91
  173. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds.pyc +0 -0
  174. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/kernel_cmds_test.py +0 -56
  175. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds.py +0 -106
  176. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds.pyc +0 -0
  177. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/machine_type_cmds_test.py +0 -59
  178. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata.py +0 -96
  179. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata.pyc +0 -0
  180. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_lib.py +0 -357
  181. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_lib.pyc +0 -0
  182. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/metadata_test.py +0 -84
  183. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/mock_api.py +0 -420
  184. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/mock_metadata.py +0 -58
  185. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds.py +0 -824
  186. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds.pyc +0 -0
  187. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/move_cmds_test.py +0 -307
  188. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds.py +0 -178
  189. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds.pyc +0 -0
  190. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/network_cmds_test.py +0 -133
  191. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds.py +0 -181
  192. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds.pyc +0 -0
  193. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/operation_cmds_test.py +0 -196
  194. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/path_initializer.py +0 -38
  195. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/path_initializer.pyc +0 -0
  196. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds.py +0 -173
  197. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds.pyc +0 -0
  198. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/project_cmds_test.py +0 -111
  199. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes.py +0 -61
  200. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes.pyc +0 -0
  201. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/scopes_test.py +0 -50
  202. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds.py +0 -276
  203. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds.pyc +0 -0
  204. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/snapshot_cmds_test.py +0 -260
  205. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys.py +0 -266
  206. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys.pyc +0 -0
  207. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/ssh_keys_test.py +0 -128
  208. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/table_formatter.py +0 -563
  209. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/table_formatter.pyc +0 -0
  210. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool.py +0 -188
  211. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool.pyc +0 -0
  212. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/thread_pool_test.py +0 -88
  213. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils.py +0 -208
  214. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils.pyc +0 -0
  215. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/utils_test.py +0 -193
  216. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version.pyc +0 -0
  217. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker.py +0 -246
  218. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker.pyc +0 -0
  219. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/version_checker_test.py +0 -271
  220. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds.py +0 -151
  221. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds.pyc +0 -0
  222. data/packages/gcutil-1.7.1/lib/google_compute_engine/gcutil/zone_cmds_test.py +0 -60
  223. data/packages/gcutil-1.7.1/lib/httplib2/LICENSE +0 -21
  224. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/__init__.py +0 -1630
  225. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/__init__.pyc +0 -0
  226. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/cacerts.txt +0 -714
  227. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/iri2uri.py +0 -110
  228. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/iri2uri.pyc +0 -0
  229. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/socks.py +0 -438
  230. data/packages/gcutil-1.7.1/lib/httplib2/httplib2/socks.pyc +0 -0
  231. data/packages/gcutil-1.7.1/lib/iso8601/LICENSE +0 -20
  232. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/__init__.py +0 -1
  233. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/__init__.pyc +0 -0
  234. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/iso8601.py +0 -102
  235. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/iso8601.pyc +0 -0
  236. data/packages/gcutil-1.7.1/lib/iso8601/iso8601/test_iso8601.py +0 -111
  237. data/packages/gcutil-1.7.1/lib/python_gflags/AUTHORS +0 -2
  238. data/packages/gcutil-1.7.1/lib/python_gflags/LICENSE +0 -28
  239. data/packages/gcutil-1.7.1/lib/python_gflags/gflags.py +0 -2862
  240. data/packages/gcutil-1.7.1/lib/python_gflags/gflags.pyc +0 -0
  241. data/packages/gcutil-1.7.1/lib/python_gflags/gflags2man.py +0 -544
  242. data/packages/gcutil-1.7.1/lib/python_gflags/gflags_validators.py +0 -187
  243. data/packages/gcutil-1.7.1/lib/python_gflags/gflags_validators.pyc +0 -0
  244. data/packages/gsutil.tar.gz +0 -0
  245. data/packages/gsutil/CHECKSUM +0 -1
  246. data/packages/gsutil/COPYING +0 -202
  247. data/packages/gsutil/LICENSE.third_party +0 -295
  248. data/packages/gsutil/MANIFEST.in +0 -5
  249. data/packages/gsutil/README +0 -38
  250. data/packages/gsutil/README.pkg +0 -49
  251. data/packages/gsutil/ReleaseNotes.txt +0 -780
  252. data/packages/gsutil/VERSION +0 -1
  253. data/packages/gsutil/boto/Changelog.rst +0 -35
  254. data/packages/gsutil/boto/LICENSE +0 -18
  255. data/packages/gsutil/boto/MANIFEST.in +0 -12
  256. data/packages/gsutil/boto/README.rst +0 -163
  257. data/packages/gsutil/boto/bin/asadmin +0 -290
  258. data/packages/gsutil/boto/bin/bundle_image +0 -27
  259. data/packages/gsutil/boto/bin/cfadmin +0 -108
  260. data/packages/gsutil/boto/bin/cq +0 -89
  261. data/packages/gsutil/boto/bin/cwutil +0 -140
  262. data/packages/gsutil/boto/bin/elbadmin +0 -284
  263. data/packages/gsutil/boto/bin/fetch_file +0 -43
  264. data/packages/gsutil/boto/bin/glacier +0 -154
  265. data/packages/gsutil/boto/bin/instance_events +0 -145
  266. data/packages/gsutil/boto/bin/kill_instance +0 -35
  267. data/packages/gsutil/boto/bin/launch_instance +0 -252
  268. data/packages/gsutil/boto/bin/list_instances +0 -90
  269. data/packages/gsutil/boto/bin/lss3 +0 -77
  270. data/packages/gsutil/boto/bin/mturk +0 -465
  271. data/packages/gsutil/boto/bin/pyami_sendmail +0 -52
  272. data/packages/gsutil/boto/bin/route53 +0 -205
  273. data/packages/gsutil/boto/bin/s3put +0 -374
  274. data/packages/gsutil/boto/bin/sdbadmin +0 -194
  275. data/packages/gsutil/boto/bin/taskadmin +0 -116
  276. data/packages/gsutil/boto/boto/__init__.py +0 -793
  277. data/packages/gsutil/boto/boto/__init__.pyc +0 -0
  278. data/packages/gsutil/boto/boto/auth.py +0 -682
  279. data/packages/gsutil/boto/boto/auth.pyc +0 -0
  280. data/packages/gsutil/boto/boto/auth_handler.py +0 -58
  281. data/packages/gsutil/boto/boto/auth_handler.pyc +0 -0
  282. data/packages/gsutil/boto/boto/beanstalk/__init__.py +0 -65
  283. data/packages/gsutil/boto/boto/beanstalk/exception.py +0 -64
  284. data/packages/gsutil/boto/boto/beanstalk/layer1.py +0 -1153
  285. data/packages/gsutil/boto/boto/beanstalk/response.py +0 -703
  286. data/packages/gsutil/boto/boto/beanstalk/wrapper.py +0 -29
  287. data/packages/gsutil/boto/boto/cacerts/__init__.py +0 -22
  288. data/packages/gsutil/boto/boto/cacerts/__init__.pyc +0 -0
  289. data/packages/gsutil/boto/boto/cacerts/cacerts.txt +0 -633
  290. data/packages/gsutil/boto/boto/cloudformation/__init__.py +0 -68
  291. data/packages/gsutil/boto/boto/cloudformation/connection.py +0 -364
  292. data/packages/gsutil/boto/boto/cloudformation/stack.py +0 -360
  293. data/packages/gsutil/boto/boto/cloudformation/template.py +0 -43
  294. data/packages/gsutil/boto/boto/cloudfront/__init__.py +0 -324
  295. data/packages/gsutil/boto/boto/cloudfront/distribution.py +0 -745
  296. data/packages/gsutil/boto/boto/cloudfront/exception.py +0 -26
  297. data/packages/gsutil/boto/boto/cloudfront/identity.py +0 -122
  298. data/packages/gsutil/boto/boto/cloudfront/invalidation.py +0 -216
  299. data/packages/gsutil/boto/boto/cloudfront/logging.py +0 -38
  300. data/packages/gsutil/boto/boto/cloudfront/object.py +0 -48
  301. data/packages/gsutil/boto/boto/cloudfront/origin.py +0 -150
  302. data/packages/gsutil/boto/boto/cloudfront/signers.py +0 -60
  303. data/packages/gsutil/boto/boto/cloudsearch/__init__.py +0 -45
  304. data/packages/gsutil/boto/boto/cloudsearch/document.py +0 -265
  305. data/packages/gsutil/boto/boto/cloudsearch/domain.py +0 -394
  306. data/packages/gsutil/boto/boto/cloudsearch/layer1.py +0 -738
  307. data/packages/gsutil/boto/boto/cloudsearch/layer2.py +0 -67
  308. data/packages/gsutil/boto/boto/cloudsearch/optionstatus.py +0 -248
  309. data/packages/gsutil/boto/boto/cloudsearch/search.py +0 -365
  310. data/packages/gsutil/boto/boto/cloudsearch/sourceattribute.py +0 -75
  311. data/packages/gsutil/boto/boto/compat.py +0 -28
  312. data/packages/gsutil/boto/boto/compat.pyc +0 -0
  313. data/packages/gsutil/boto/boto/connection.py +0 -1081
  314. data/packages/gsutil/boto/boto/connection.pyc +0 -0
  315. data/packages/gsutil/boto/boto/contrib/__init__.py +0 -22
  316. data/packages/gsutil/boto/boto/contrib/ymlmessage.py +0 -52
  317. data/packages/gsutil/boto/boto/core/README +0 -58
  318. data/packages/gsutil/boto/boto/core/__init__.py +0 -23
  319. data/packages/gsutil/boto/boto/core/auth.py +0 -78
  320. data/packages/gsutil/boto/boto/core/credentials.py +0 -154
  321. data/packages/gsutil/boto/boto/core/dictresponse.py +0 -178
  322. data/packages/gsutil/boto/boto/core/service.py +0 -67
  323. data/packages/gsutil/boto/boto/datapipeline/__init__.py +0 -0
  324. data/packages/gsutil/boto/boto/datapipeline/exceptions.py +0 -42
  325. data/packages/gsutil/boto/boto/datapipeline/layer1.py +0 -546
  326. data/packages/gsutil/boto/boto/dynamodb/__init__.py +0 -66
  327. data/packages/gsutil/boto/boto/dynamodb/batch.py +0 -262
  328. data/packages/gsutil/boto/boto/dynamodb/condition.py +0 -170
  329. data/packages/gsutil/boto/boto/dynamodb/exceptions.py +0 -64
  330. data/packages/gsutil/boto/boto/dynamodb/item.py +0 -196
  331. data/packages/gsutil/boto/boto/dynamodb/layer1.py +0 -575
  332. data/packages/gsutil/boto/boto/dynamodb/layer2.py +0 -798
  333. data/packages/gsutil/boto/boto/dynamodb/schema.py +0 -112
  334. data/packages/gsutil/boto/boto/dynamodb/table.py +0 -540
  335. data/packages/gsutil/boto/boto/dynamodb/types.py +0 -326
  336. data/packages/gsutil/boto/boto/ec2/__init__.py +0 -96
  337. data/packages/gsutil/boto/boto/ec2/address.py +0 -103
  338. data/packages/gsutil/boto/boto/ec2/autoscale/__init__.py +0 -781
  339. data/packages/gsutil/boto/boto/ec2/autoscale/activity.py +0 -74
  340. data/packages/gsutil/boto/boto/ec2/autoscale/group.py +0 -337
  341. data/packages/gsutil/boto/boto/ec2/autoscale/instance.py +0 -60
  342. data/packages/gsutil/boto/boto/ec2/autoscale/launchconfig.py +0 -209
  343. data/packages/gsutil/boto/boto/ec2/autoscale/policy.py +0 -166
  344. data/packages/gsutil/boto/boto/ec2/autoscale/request.py +0 -38
  345. data/packages/gsutil/boto/boto/ec2/autoscale/scheduled.py +0 -60
  346. data/packages/gsutil/boto/boto/ec2/autoscale/tag.py +0 -84
  347. data/packages/gsutil/boto/boto/ec2/blockdevicemapping.py +0 -141
  348. data/packages/gsutil/boto/boto/ec2/bundleinstance.py +0 -78
  349. data/packages/gsutil/boto/boto/ec2/buyreservation.py +0 -84
  350. data/packages/gsutil/boto/boto/ec2/cloudwatch/__init__.py +0 -603
  351. data/packages/gsutil/boto/boto/ec2/cloudwatch/alarm.py +0 -316
  352. data/packages/gsutil/boto/boto/ec2/cloudwatch/datapoint.py +0 -40
  353. data/packages/gsutil/boto/boto/ec2/cloudwatch/dimension.py +0 -38
  354. data/packages/gsutil/boto/boto/ec2/cloudwatch/listelement.py +0 -31
  355. data/packages/gsutil/boto/boto/ec2/cloudwatch/metric.py +0 -175
  356. data/packages/gsutil/boto/boto/ec2/connection.py +0 -3409
  357. data/packages/gsutil/boto/boto/ec2/ec2object.py +0 -107
  358. data/packages/gsutil/boto/boto/ec2/elb/__init__.py +0 -553
  359. data/packages/gsutil/boto/boto/ec2/elb/healthcheck.py +0 -89
  360. data/packages/gsutil/boto/boto/ec2/elb/instancestate.py +0 -62
  361. data/packages/gsutil/boto/boto/ec2/elb/listelement.py +0 -36
  362. data/packages/gsutil/boto/boto/ec2/elb/listener.py +0 -75
  363. data/packages/gsutil/boto/boto/ec2/elb/loadbalancer.py +0 -324
  364. data/packages/gsutil/boto/boto/ec2/elb/policies.py +0 -89
  365. data/packages/gsutil/boto/boto/ec2/elb/securitygroup.py +0 -38
  366. data/packages/gsutil/boto/boto/ec2/group.py +0 -39
  367. data/packages/gsutil/boto/boto/ec2/image.py +0 -350
  368. data/packages/gsutil/boto/boto/ec2/instance.py +0 -661
  369. data/packages/gsutil/boto/boto/ec2/instanceinfo.py +0 -51
  370. data/packages/gsutil/boto/boto/ec2/instancestatus.py +0 -207
  371. data/packages/gsutil/boto/boto/ec2/keypair.py +0 -113
  372. data/packages/gsutil/boto/boto/ec2/launchspecification.py +0 -105
  373. data/packages/gsutil/boto/boto/ec2/networkinterface.py +0 -247
  374. data/packages/gsutil/boto/boto/ec2/placementgroup.py +0 -51
  375. data/packages/gsutil/boto/boto/ec2/regioninfo.py +0 -34
  376. data/packages/gsutil/boto/boto/ec2/reservedinstance.py +0 -227
  377. data/packages/gsutil/boto/boto/ec2/securitygroup.py +0 -357
  378. data/packages/gsutil/boto/boto/ec2/snapshot.py +0 -170
  379. data/packages/gsutil/boto/boto/ec2/spotdatafeedsubscription.py +0 -63
  380. data/packages/gsutil/boto/boto/ec2/spotinstancerequest.py +0 -188
  381. data/packages/gsutil/boto/boto/ec2/spotpricehistory.py +0 -55
  382. data/packages/gsutil/boto/boto/ec2/tag.py +0 -87
  383. data/packages/gsutil/boto/boto/ec2/vmtype.py +0 -58
  384. data/packages/gsutil/boto/boto/ec2/volume.py +0 -293
  385. data/packages/gsutil/boto/boto/ec2/volumestatus.py +0 -200
  386. data/packages/gsutil/boto/boto/ec2/zone.py +0 -80
  387. data/packages/gsutil/boto/boto/ecs/__init__.py +0 -90
  388. data/packages/gsutil/boto/boto/ecs/item.py +0 -153
  389. data/packages/gsutil/boto/boto/elasticache/__init__.py +0 -62
  390. data/packages/gsutil/boto/boto/elasticache/layer1.py +0 -1252
  391. data/packages/gsutil/boto/boto/elastictranscoder/__init__.py +0 -62
  392. data/packages/gsutil/boto/boto/elastictranscoder/exceptions.py +0 -46
  393. data/packages/gsutil/boto/boto/elastictranscoder/layer1.py +0 -509
  394. data/packages/gsutil/boto/boto/emr/__init__.py +0 -73
  395. data/packages/gsutil/boto/boto/emr/bootstrap_action.py +0 -44
  396. data/packages/gsutil/boto/boto/emr/connection.py +0 -531
  397. data/packages/gsutil/boto/boto/emr/emrobject.py +0 -176
  398. data/packages/gsutil/boto/boto/emr/instance_group.py +0 -43
  399. data/packages/gsutil/boto/boto/emr/step.py +0 -281
  400. data/packages/gsutil/boto/boto/exception.py +0 -476
  401. data/packages/gsutil/boto/boto/exception.pyc +0 -0
  402. data/packages/gsutil/boto/boto/file/README +0 -49
  403. data/packages/gsutil/boto/boto/file/__init__.py +0 -28
  404. data/packages/gsutil/boto/boto/file/bucket.py +0 -112
  405. data/packages/gsutil/boto/boto/file/connection.py +0 -33
  406. data/packages/gsutil/boto/boto/file/key.py +0 -199
  407. data/packages/gsutil/boto/boto/file/simpleresultset.py +0 -30
  408. data/packages/gsutil/boto/boto/fps/__init__.py +0 -21
  409. data/packages/gsutil/boto/boto/fps/connection.py +0 -369
  410. data/packages/gsutil/boto/boto/fps/exception.py +0 -344
  411. data/packages/gsutil/boto/boto/fps/response.py +0 -175
  412. data/packages/gsutil/boto/boto/glacier/__init__.py +0 -57
  413. data/packages/gsutil/boto/boto/glacier/concurrent.py +0 -409
  414. data/packages/gsutil/boto/boto/glacier/exceptions.py +0 -58
  415. data/packages/gsutil/boto/boto/glacier/job.py +0 -152
  416. data/packages/gsutil/boto/boto/glacier/layer1.py +0 -637
  417. data/packages/gsutil/boto/boto/glacier/layer2.py +0 -93
  418. data/packages/gsutil/boto/boto/glacier/response.py +0 -48
  419. data/packages/gsutil/boto/boto/glacier/utils.py +0 -163
  420. data/packages/gsutil/boto/boto/glacier/vault.py +0 -387
  421. data/packages/gsutil/boto/boto/glacier/writer.py +0 -242
  422. data/packages/gsutil/boto/boto/gs/__init__.py +0 -22
  423. data/packages/gsutil/boto/boto/gs/__init__.pyc +0 -0
  424. data/packages/gsutil/boto/boto/gs/acl.py +0 -304
  425. data/packages/gsutil/boto/boto/gs/acl.pyc +0 -0
  426. data/packages/gsutil/boto/boto/gs/bucket.py +0 -870
  427. data/packages/gsutil/boto/boto/gs/bucket.pyc +0 -0
  428. data/packages/gsutil/boto/boto/gs/bucketlistresultset.py +0 -64
  429. data/packages/gsutil/boto/boto/gs/bucketlistresultset.pyc +0 -0
  430. data/packages/gsutil/boto/boto/gs/connection.py +0 -103
  431. data/packages/gsutil/boto/boto/gs/connection.pyc +0 -0
  432. data/packages/gsutil/boto/boto/gs/cors.py +0 -169
  433. data/packages/gsutil/boto/boto/gs/cors.pyc +0 -0
  434. data/packages/gsutil/boto/boto/gs/key.py +0 -704
  435. data/packages/gsutil/boto/boto/gs/key.pyc +0 -0
  436. data/packages/gsutil/boto/boto/gs/resumable_upload_handler.py +0 -659
  437. data/packages/gsutil/boto/boto/gs/resumable_upload_handler.pyc +0 -0
  438. data/packages/gsutil/boto/boto/gs/user.py +0 -54
  439. data/packages/gsutil/boto/boto/gs/user.pyc +0 -0
  440. data/packages/gsutil/boto/boto/handler.py +0 -44
  441. data/packages/gsutil/boto/boto/handler.pyc +0 -0
  442. data/packages/gsutil/boto/boto/https_connection.py +0 -124
  443. data/packages/gsutil/boto/boto/https_connection.pyc +0 -0
  444. data/packages/gsutil/boto/boto/iam/__init__.py +0 -74
  445. data/packages/gsutil/boto/boto/iam/connection.py +0 -1317
  446. data/packages/gsutil/boto/boto/iam/summarymap.py +0 -42
  447. data/packages/gsutil/boto/boto/jsonresponse.py +0 -163
  448. data/packages/gsutil/boto/boto/jsonresponse.pyc +0 -0
  449. data/packages/gsutil/boto/boto/manage/__init__.py +0 -23
  450. data/packages/gsutil/boto/boto/manage/cmdshell.py +0 -241
  451. data/packages/gsutil/boto/boto/manage/propget.py +0 -64
  452. data/packages/gsutil/boto/boto/manage/server.py +0 -556
  453. data/packages/gsutil/boto/boto/manage/task.py +0 -175
  454. data/packages/gsutil/boto/boto/manage/test_manage.py +0 -34
  455. data/packages/gsutil/boto/boto/manage/volume.py +0 -420
  456. data/packages/gsutil/boto/boto/mashups/__init__.py +0 -23
  457. data/packages/gsutil/boto/boto/mashups/interactive.py +0 -97
  458. data/packages/gsutil/boto/boto/mashups/iobject.py +0 -115
  459. data/packages/gsutil/boto/boto/mashups/order.py +0 -211
  460. data/packages/gsutil/boto/boto/mashups/server.py +0 -395
  461. data/packages/gsutil/boto/boto/mturk/__init__.py +0 -23
  462. data/packages/gsutil/boto/boto/mturk/connection.py +0 -1027
  463. data/packages/gsutil/boto/boto/mturk/layoutparam.py +0 -55
  464. data/packages/gsutil/boto/boto/mturk/notification.py +0 -103
  465. data/packages/gsutil/boto/boto/mturk/price.py +0 -48
  466. data/packages/gsutil/boto/boto/mturk/qualification.py +0 -137
  467. data/packages/gsutil/boto/boto/mturk/question.py +0 -455
  468. data/packages/gsutil/boto/boto/mws/__init__.py +0 -21
  469. data/packages/gsutil/boto/boto/mws/connection.py +0 -813
  470. data/packages/gsutil/boto/boto/mws/exception.py +0 -75
  471. data/packages/gsutil/boto/boto/mws/response.py +0 -655
  472. data/packages/gsutil/boto/boto/plugin.py +0 -90
  473. data/packages/gsutil/boto/boto/plugin.pyc +0 -0
  474. data/packages/gsutil/boto/boto/provider.py +0 -337
  475. data/packages/gsutil/boto/boto/provider.pyc +0 -0
  476. data/packages/gsutil/boto/boto/pyami/__init__.py +0 -22
  477. data/packages/gsutil/boto/boto/pyami/__init__.pyc +0 -0
  478. data/packages/gsutil/boto/boto/pyami/bootstrap.py +0 -134
  479. data/packages/gsutil/boto/boto/pyami/config.py +0 -229
  480. data/packages/gsutil/boto/boto/pyami/config.pyc +0 -0
  481. data/packages/gsutil/boto/boto/pyami/copybot.cfg +0 -60
  482. data/packages/gsutil/boto/boto/pyami/copybot.py +0 -97
  483. data/packages/gsutil/boto/boto/pyami/helloworld.py +0 -28
  484. data/packages/gsutil/boto/boto/pyami/installers/__init__.py +0 -64
  485. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/__init__.py +0 -22
  486. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/apache.py +0 -43
  487. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/ebs.py +0 -238
  488. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/installer.py +0 -96
  489. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/mysql.py +0 -109
  490. data/packages/gsutil/boto/boto/pyami/installers/ubuntu/trac.py +0 -139
  491. data/packages/gsutil/boto/boto/pyami/launch_ami.py +0 -178
  492. data/packages/gsutil/boto/boto/pyami/scriptbase.py +0 -44
  493. data/packages/gsutil/boto/boto/pyami/startup.py +0 -60
  494. data/packages/gsutil/boto/boto/rds/__init__.py +0 -1194
  495. data/packages/gsutil/boto/boto/rds/dbinstance.py +0 -357
  496. data/packages/gsutil/boto/boto/rds/dbsecuritygroup.py +0 -177
  497. data/packages/gsutil/boto/boto/rds/dbsnapshot.py +0 -108
  498. data/packages/gsutil/boto/boto/rds/event.py +0 -49
  499. data/packages/gsutil/boto/boto/rds/parametergroup.py +0 -201
  500. data/packages/gsutil/boto/boto/rds/regioninfo.py +0 -32
  501. data/packages/gsutil/boto/boto/regioninfo.py +0 -63
  502. data/packages/gsutil/boto/boto/regioninfo.pyc +0 -0
  503. data/packages/gsutil/boto/boto/resultset.py +0 -169
  504. data/packages/gsutil/boto/boto/resultset.pyc +0 -0
  505. data/packages/gsutil/boto/boto/roboto/__init__.py +0 -1
  506. data/packages/gsutil/boto/boto/roboto/awsqueryrequest.py +0 -504
  507. data/packages/gsutil/boto/boto/roboto/awsqueryservice.py +0 -121
  508. data/packages/gsutil/boto/boto/roboto/param.py +0 -147
  509. data/packages/gsutil/boto/boto/route53/__init__.py +0 -75
  510. data/packages/gsutil/boto/boto/route53/connection.py +0 -403
  511. data/packages/gsutil/boto/boto/route53/exception.py +0 -27
  512. data/packages/gsutil/boto/boto/route53/hostedzone.py +0 -56
  513. data/packages/gsutil/boto/boto/route53/record.py +0 -306
  514. data/packages/gsutil/boto/boto/route53/status.py +0 -42
  515. data/packages/gsutil/boto/boto/route53/zone.py +0 -412
  516. data/packages/gsutil/boto/boto/s3/__init__.py +0 -84
  517. data/packages/gsutil/boto/boto/s3/__init__.pyc +0 -0
  518. data/packages/gsutil/boto/boto/s3/acl.py +0 -164
  519. data/packages/gsutil/boto/boto/s3/acl.pyc +0 -0
  520. data/packages/gsutil/boto/boto/s3/bucket.py +0 -1634
  521. data/packages/gsutil/boto/boto/s3/bucket.pyc +0 -0
  522. data/packages/gsutil/boto/boto/s3/bucketlistresultset.py +0 -139
  523. data/packages/gsutil/boto/boto/s3/bucketlistresultset.pyc +0 -0
  524. data/packages/gsutil/boto/boto/s3/bucketlogging.py +0 -83
  525. data/packages/gsutil/boto/boto/s3/bucketlogging.pyc +0 -0
  526. data/packages/gsutil/boto/boto/s3/connection.py +0 -540
  527. data/packages/gsutil/boto/boto/s3/connection.pyc +0 -0
  528. data/packages/gsutil/boto/boto/s3/cors.py +0 -210
  529. data/packages/gsutil/boto/boto/s3/cors.pyc +0 -0
  530. data/packages/gsutil/boto/boto/s3/deletemarker.py +0 -55
  531. data/packages/gsutil/boto/boto/s3/deletemarker.pyc +0 -0
  532. data/packages/gsutil/boto/boto/s3/key.py +0 -1712
  533. data/packages/gsutil/boto/boto/s3/key.pyc +0 -0
  534. data/packages/gsutil/boto/boto/s3/keyfile.py +0 -134
  535. data/packages/gsutil/boto/boto/s3/keyfile.pyc +0 -0
  536. data/packages/gsutil/boto/boto/s3/lifecycle.py +0 -231
  537. data/packages/gsutil/boto/boto/s3/lifecycle.pyc +0 -0
  538. data/packages/gsutil/boto/boto/s3/multidelete.py +0 -138
  539. data/packages/gsutil/boto/boto/s3/multidelete.pyc +0 -0
  540. data/packages/gsutil/boto/boto/s3/multipart.py +0 -315
  541. data/packages/gsutil/boto/boto/s3/multipart.pyc +0 -0
  542. data/packages/gsutil/boto/boto/s3/prefix.py +0 -42
  543. data/packages/gsutil/boto/boto/s3/prefix.pyc +0 -0
  544. data/packages/gsutil/boto/boto/s3/resumable_download_handler.py +0 -339
  545. data/packages/gsutil/boto/boto/s3/resumable_download_handler.pyc +0 -0
  546. data/packages/gsutil/boto/boto/s3/tagging.py +0 -71
  547. data/packages/gsutil/boto/boto/s3/tagging.pyc +0 -0
  548. data/packages/gsutil/boto/boto/s3/user.py +0 -49
  549. data/packages/gsutil/boto/boto/s3/user.pyc +0 -0
  550. data/packages/gsutil/boto/boto/s3/website.py +0 -237
  551. data/packages/gsutil/boto/boto/s3/website.pyc +0 -0
  552. data/packages/gsutil/boto/boto/sdb/__init__.py +0 -67
  553. data/packages/gsutil/boto/boto/sdb/connection.py +0 -617
  554. data/packages/gsutil/boto/boto/sdb/db/__init__.py +0 -20
  555. data/packages/gsutil/boto/boto/sdb/db/blob.py +0 -75
  556. data/packages/gsutil/boto/boto/sdb/db/key.py +0 -59
  557. data/packages/gsutil/boto/boto/sdb/db/manager/__init__.py +0 -85
  558. data/packages/gsutil/boto/boto/sdb/db/manager/sdbmanager.py +0 -732
  559. data/packages/gsutil/boto/boto/sdb/db/manager/xmlmanager.py +0 -517
  560. data/packages/gsutil/boto/boto/sdb/db/model.py +0 -294
  561. data/packages/gsutil/boto/boto/sdb/db/property.py +0 -703
  562. data/packages/gsutil/boto/boto/sdb/db/query.py +0 -85
  563. data/packages/gsutil/boto/boto/sdb/db/sequence.py +0 -226
  564. data/packages/gsutil/boto/boto/sdb/db/test_db.py +0 -231
  565. data/packages/gsutil/boto/boto/sdb/domain.py +0 -377
  566. data/packages/gsutil/boto/boto/sdb/item.py +0 -181
  567. data/packages/gsutil/boto/boto/sdb/queryresultset.py +0 -92
  568. data/packages/gsutil/boto/boto/sdb/regioninfo.py +0 -32
  569. data/packages/gsutil/boto/boto/services/__init__.py +0 -23
  570. data/packages/gsutil/boto/boto/services/bs.py +0 -179
  571. data/packages/gsutil/boto/boto/services/message.py +0 -58
  572. data/packages/gsutil/boto/boto/services/result.py +0 -136
  573. data/packages/gsutil/boto/boto/services/service.py +0 -161
  574. data/packages/gsutil/boto/boto/services/servicedef.py +0 -91
  575. data/packages/gsutil/boto/boto/services/sonofmmm.cfg +0 -43
  576. data/packages/gsutil/boto/boto/services/sonofmmm.py +0 -81
  577. data/packages/gsutil/boto/boto/services/submit.py +0 -88
  578. data/packages/gsutil/boto/boto/ses/__init__.py +0 -54
  579. data/packages/gsutil/boto/boto/ses/connection.py +0 -521
  580. data/packages/gsutil/boto/boto/ses/exceptions.py +0 -77
  581. data/packages/gsutil/boto/boto/sns/__init__.py +0 -78
  582. data/packages/gsutil/boto/boto/sns/connection.py +0 -431
  583. data/packages/gsutil/boto/boto/sqs/__init__.py +0 -56
  584. data/packages/gsutil/boto/boto/sqs/attributes.py +0 -46
  585. data/packages/gsutil/boto/boto/sqs/batchresults.py +0 -95
  586. data/packages/gsutil/boto/boto/sqs/connection.py +0 -417
  587. data/packages/gsutil/boto/boto/sqs/jsonmessage.py +0 -43
  588. data/packages/gsutil/boto/boto/sqs/message.py +0 -253
  589. data/packages/gsutil/boto/boto/sqs/queue.py +0 -478
  590. data/packages/gsutil/boto/boto/sqs/regioninfo.py +0 -32
  591. data/packages/gsutil/boto/boto/storage_uri.py +0 -835
  592. data/packages/gsutil/boto/boto/storage_uri.pyc +0 -0
  593. data/packages/gsutil/boto/boto/sts/__init__.py +0 -55
  594. data/packages/gsutil/boto/boto/sts/connection.py +0 -207
  595. data/packages/gsutil/boto/boto/sts/credentials.py +0 -215
  596. data/packages/gsutil/boto/boto/swf/__init__.py +0 -60
  597. data/packages/gsutil/boto/boto/swf/exceptions.py +0 -44
  598. data/packages/gsutil/boto/boto/swf/layer1.py +0 -1512
  599. data/packages/gsutil/boto/boto/swf/layer1_decisions.py +0 -287
  600. data/packages/gsutil/boto/boto/swf/layer2.py +0 -342
  601. data/packages/gsutil/boto/boto/utils.py +0 -927
  602. data/packages/gsutil/boto/boto/utils.pyc +0 -0
  603. data/packages/gsutil/boto/boto/vpc/__init__.py +0 -910
  604. data/packages/gsutil/boto/boto/vpc/customergateway.py +0 -54
  605. data/packages/gsutil/boto/boto/vpc/dhcpoptions.py +0 -72
  606. data/packages/gsutil/boto/boto/vpc/internetgateway.py +0 -72
  607. data/packages/gsutil/boto/boto/vpc/routetable.py +0 -109
  608. data/packages/gsutil/boto/boto/vpc/subnet.py +0 -57
  609. data/packages/gsutil/boto/boto/vpc/vpc.py +0 -54
  610. data/packages/gsutil/boto/boto/vpc/vpnconnection.py +0 -60
  611. data/packages/gsutil/boto/boto/vpc/vpngateway.py +0 -83
  612. data/packages/gsutil/boto/docs/BotoCheatSheet.pdf +0 -0
  613. data/packages/gsutil/boto/docs/Makefile +0 -89
  614. data/packages/gsutil/boto/docs/make.bat +0 -113
  615. data/packages/gsutil/boto/docs/source/_templates/layout.html +0 -3
  616. data/packages/gsutil/boto/docs/source/autoscale_tut.rst +0 -220
  617. data/packages/gsutil/boto/docs/source/boto_config_tut.rst +0 -125
  618. data/packages/gsutil/boto/docs/source/boto_theme/static/boto.css_t +0 -239
  619. data/packages/gsutil/boto/docs/source/boto_theme/static/pygments.css +0 -61
  620. data/packages/gsutil/boto/docs/source/boto_theme/theme.conf +0 -3
  621. data/packages/gsutil/boto/docs/source/cloudfront_tut.rst +0 -196
  622. data/packages/gsutil/boto/docs/source/cloudsearch_tut.rst +0 -411
  623. data/packages/gsutil/boto/docs/source/cloudwatch_tut.rst +0 -116
  624. data/packages/gsutil/boto/docs/source/conf.py +0 -32
  625. data/packages/gsutil/boto/docs/source/contributing.rst +0 -204
  626. data/packages/gsutil/boto/docs/source/documentation.rst +0 -59
  627. data/packages/gsutil/boto/docs/source/dynamodb_tut.rst +0 -339
  628. data/packages/gsutil/boto/docs/source/ec2_tut.rst +0 -86
  629. data/packages/gsutil/boto/docs/source/elb_tut.rst +0 -257
  630. data/packages/gsutil/boto/docs/source/emr_tut.rst +0 -108
  631. data/packages/gsutil/boto/docs/source/index.rst +0 -146
  632. data/packages/gsutil/boto/docs/source/rds_tut.rst +0 -108
  633. data/packages/gsutil/boto/docs/source/ref/autoscale.rst +0 -62
  634. data/packages/gsutil/boto/docs/source/ref/beanstalk.rst +0 -26
  635. data/packages/gsutil/boto/docs/source/ref/boto.rst +0 -47
  636. data/packages/gsutil/boto/docs/source/ref/cloudformation.rst +0 -34
  637. data/packages/gsutil/boto/docs/source/ref/cloudfront.rst +0 -68
  638. data/packages/gsutil/boto/docs/source/ref/cloudsearch.rst +0 -59
  639. data/packages/gsutil/boto/docs/source/ref/cloudwatch.rst +0 -27
  640. data/packages/gsutil/boto/docs/source/ref/contrib.rst +0 -32
  641. data/packages/gsutil/boto/docs/source/ref/datapipeline.rst +0 -26
  642. data/packages/gsutil/boto/docs/source/ref/dynamodb.rst +0 -61
  643. data/packages/gsutil/boto/docs/source/ref/ec2.rst +0 -140
  644. data/packages/gsutil/boto/docs/source/ref/ecs.rst +0 -19
  645. data/packages/gsutil/boto/docs/source/ref/elasticache.rst +0 -19
  646. data/packages/gsutil/boto/docs/source/ref/elastictranscoder.rst +0 -26
  647. data/packages/gsutil/boto/docs/source/ref/elb.rst +0 -47
  648. data/packages/gsutil/boto/docs/source/ref/emr.rst +0 -34
  649. data/packages/gsutil/boto/docs/source/ref/file.rst +0 -34
  650. data/packages/gsutil/boto/docs/source/ref/fps.rst +0 -19
  651. data/packages/gsutil/boto/docs/source/ref/glacier.rst +0 -63
  652. data/packages/gsutil/boto/docs/source/ref/gs.rst +0 -72
  653. data/packages/gsutil/boto/docs/source/ref/iam.rst +0 -27
  654. data/packages/gsutil/boto/docs/source/ref/index.rst +0 -40
  655. data/packages/gsutil/boto/docs/source/ref/manage.rst +0 -47
  656. data/packages/gsutil/boto/docs/source/ref/mturk.rst +0 -54
  657. data/packages/gsutil/boto/docs/source/ref/mws.rst +0 -33
  658. data/packages/gsutil/boto/docs/source/ref/pyami.rst +0 -103
  659. data/packages/gsutil/boto/docs/source/ref/rds.rst +0 -47
  660. data/packages/gsutil/boto/docs/source/ref/route53.rst +0 -34
  661. data/packages/gsutil/boto/docs/source/ref/s3.rst +0 -111
  662. data/packages/gsutil/boto/docs/source/ref/sdb.rst +0 -45
  663. data/packages/gsutil/boto/docs/source/ref/sdb_db.rst +0 -83
  664. data/packages/gsutil/boto/docs/source/ref/services.rst +0 -61
  665. data/packages/gsutil/boto/docs/source/ref/ses.rst +0 -21
  666. data/packages/gsutil/boto/docs/source/ref/sns.rst +0 -17
  667. data/packages/gsutil/boto/docs/source/ref/sqs.rst +0 -61
  668. data/packages/gsutil/boto/docs/source/ref/sts.rst +0 -25
  669. data/packages/gsutil/boto/docs/source/ref/swf.rst +0 -22
  670. data/packages/gsutil/boto/docs/source/ref/vpc.rst +0 -54
  671. data/packages/gsutil/boto/docs/source/s3_tut.rst +0 -450
  672. data/packages/gsutil/boto/docs/source/security_groups.rst +0 -82
  673. data/packages/gsutil/boto/docs/source/ses_tut.rst +0 -171
  674. data/packages/gsutil/boto/docs/source/simpledb_tut.rst +0 -188
  675. data/packages/gsutil/boto/docs/source/sqs_tut.rst +0 -246
  676. data/packages/gsutil/boto/docs/source/vpc_tut.rst +0 -100
  677. data/packages/gsutil/boto/pylintrc +0 -305
  678. data/packages/gsutil/boto/requirements.txt +0 -10
  679. data/packages/gsutil/boto/setup.py +0 -89
  680. data/packages/gsutil/boto/tests/__init__.py +0 -20
  681. data/packages/gsutil/boto/tests/db/test_lists.py +0 -96
  682. data/packages/gsutil/boto/tests/db/test_password.py +0 -128
  683. data/packages/gsutil/boto/tests/db/test_query.py +0 -152
  684. data/packages/gsutil/boto/tests/db/test_sequence.py +0 -109
  685. data/packages/gsutil/boto/tests/devpay/__init__.py +0 -0
  686. data/packages/gsutil/boto/tests/devpay/test_s3.py +0 -181
  687. data/packages/gsutil/boto/tests/fps/__init__.py +0 -0
  688. data/packages/gsutil/boto/tests/fps/test.py +0 -100
  689. data/packages/gsutil/boto/tests/fps/test_verify_signature.py +0 -12
  690. data/packages/gsutil/boto/tests/integration/__init__.py +0 -0
  691. data/packages/gsutil/boto/tests/integration/beanstalk/test_wrapper.py +0 -209
  692. data/packages/gsutil/boto/tests/integration/cloudformation/__init__.py +0 -21
  693. data/packages/gsutil/boto/tests/integration/cloudformation/test_cert_verification.py +0 -40
  694. data/packages/gsutil/boto/tests/integration/cloudformation/test_connection.py +0 -110
  695. data/packages/gsutil/boto/tests/integration/cloudsearch/__init__.py +0 -21
  696. data/packages/gsutil/boto/tests/integration/cloudsearch/test_cert_verification.py +0 -40
  697. data/packages/gsutil/boto/tests/integration/datapipeline/test_layer1.py +0 -122
  698. data/packages/gsutil/boto/tests/integration/dynamodb/__init__.py +0 -20
  699. data/packages/gsutil/boto/tests/integration/dynamodb/test_cert_verification.py +0 -40
  700. data/packages/gsutil/boto/tests/integration/dynamodb/test_layer1.py +0 -266
  701. data/packages/gsutil/boto/tests/integration/dynamodb/test_layer2.py +0 -484
  702. data/packages/gsutil/boto/tests/integration/dynamodb/test_table.py +0 -84
  703. data/packages/gsutil/boto/tests/integration/ec2/__init__.py +0 -20
  704. data/packages/gsutil/boto/tests/integration/ec2/autoscale/__init__.py +0 -21
  705. data/packages/gsutil/boto/tests/integration/ec2/autoscale/test_cert_verification.py +0 -40
  706. data/packages/gsutil/boto/tests/integration/ec2/autoscale/test_connection.py +0 -167
  707. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/__init__.py +0 -20
  708. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/test_cert_verification.py +0 -40
  709. data/packages/gsutil/boto/tests/integration/ec2/cloudwatch/test_connection.py +0 -277
  710. data/packages/gsutil/boto/tests/integration/ec2/elb/__init__.py +0 -20
  711. data/packages/gsutil/boto/tests/integration/ec2/elb/test_cert_verification.py +0 -40
  712. data/packages/gsutil/boto/tests/integration/ec2/elb/test_connection.py +0 -130
  713. data/packages/gsutil/boto/tests/integration/ec2/test_cert_verification.py +0 -40
  714. data/packages/gsutil/boto/tests/integration/ec2/test_connection.py +0 -192
  715. data/packages/gsutil/boto/tests/integration/ec2/vpc/__init__.py +0 -0
  716. data/packages/gsutil/boto/tests/integration/ec2/vpc/test_connection.py +0 -95
  717. data/packages/gsutil/boto/tests/integration/elasticache/__init__.py +0 -0
  718. data/packages/gsutil/boto/tests/integration/elasticache/test_layer1.py +0 -67
  719. data/packages/gsutil/boto/tests/integration/elastictranscoder/__init__.py +0 -0
  720. data/packages/gsutil/boto/tests/integration/elastictranscoder/test_cert_verification.py +0 -35
  721. data/packages/gsutil/boto/tests/integration/elastictranscoder/test_layer1.py +0 -115
  722. data/packages/gsutil/boto/tests/integration/emr/__init__.py +0 -20
  723. data/packages/gsutil/boto/tests/integration/emr/test_cert_verification.py +0 -40
  724. data/packages/gsutil/boto/tests/integration/glacier/__init__.py +0 -22
  725. data/packages/gsutil/boto/tests/integration/glacier/test_cert_verification.py +0 -40
  726. data/packages/gsutil/boto/tests/integration/glacier/test_layer1.py +0 -44
  727. data/packages/gsutil/boto/tests/integration/glacier/test_layer2.py +0 -45
  728. data/packages/gsutil/boto/tests/integration/gs/__init__.py +0 -0
  729. data/packages/gsutil/boto/tests/integration/gs/cb_test_harness.py +0 -71
  730. data/packages/gsutil/boto/tests/integration/gs/test_basic.py +0 -379
  731. data/packages/gsutil/boto/tests/integration/gs/test_generation_conditionals.py +0 -399
  732. data/packages/gsutil/boto/tests/integration/gs/test_resumable_downloads.py +0 -358
  733. data/packages/gsutil/boto/tests/integration/gs/test_resumable_uploads.py +0 -525
  734. data/packages/gsutil/boto/tests/integration/gs/test_storage_uri.py +0 -125
  735. data/packages/gsutil/boto/tests/integration/gs/test_versioning.py +0 -268
  736. data/packages/gsutil/boto/tests/integration/gs/testcase.py +0 -116
  737. data/packages/gsutil/boto/tests/integration/gs/util.py +0 -63
  738. data/packages/gsutil/boto/tests/integration/iam/__init__.py +0 -20
  739. data/packages/gsutil/boto/tests/integration/iam/test_cert_verification.py +0 -40
  740. data/packages/gsutil/boto/tests/integration/mws/__init__.py +0 -0
  741. data/packages/gsutil/boto/tests/integration/mws/test.py +0 -100
  742. data/packages/gsutil/boto/tests/integration/rds/__init__.py +0 -21
  743. data/packages/gsutil/boto/tests/integration/rds/test_cert_verification.py +0 -40
  744. data/packages/gsutil/boto/tests/integration/route53/__init__.py +0 -20
  745. data/packages/gsutil/boto/tests/integration/route53/test_cert_verification.py +0 -40
  746. data/packages/gsutil/boto/tests/integration/route53/test_zone.py +0 -132
  747. data/packages/gsutil/boto/tests/integration/s3/__init__.py +0 -20
  748. data/packages/gsutil/boto/tests/integration/s3/mock_storage_service.py +0 -589
  749. data/packages/gsutil/boto/tests/integration/s3/other_cacerts.txt +0 -70
  750. data/packages/gsutil/boto/tests/integration/s3/test_bucket.py +0 -263
  751. data/packages/gsutil/boto/tests/integration/s3/test_cert_verification.py +0 -40
  752. data/packages/gsutil/boto/tests/integration/s3/test_connection.py +0 -245
  753. data/packages/gsutil/boto/tests/integration/s3/test_cors.py +0 -78
  754. data/packages/gsutil/boto/tests/integration/s3/test_encryption.py +0 -115
  755. data/packages/gsutil/boto/tests/integration/s3/test_https_cert_validation.py +0 -141
  756. data/packages/gsutil/boto/tests/integration/s3/test_key.py +0 -375
  757. data/packages/gsutil/boto/tests/integration/s3/test_mfa.py +0 -95
  758. data/packages/gsutil/boto/tests/integration/s3/test_multidelete.py +0 -181
  759. data/packages/gsutil/boto/tests/integration/s3/test_multipart.py +0 -139
  760. data/packages/gsutil/boto/tests/integration/s3/test_pool.py +0 -246
  761. data/packages/gsutil/boto/tests/integration/s3/test_versioning.py +0 -158
  762. data/packages/gsutil/boto/tests/integration/sdb/__init__.py +0 -20
  763. data/packages/gsutil/boto/tests/integration/sdb/test_cert_verification.py +0 -40
  764. data/packages/gsutil/boto/tests/integration/sdb/test_connection.py +0 -119
  765. data/packages/gsutil/boto/tests/integration/ses/__init__.py +0 -0
  766. data/packages/gsutil/boto/tests/integration/ses/test_cert_verification.py +0 -40
  767. data/packages/gsutil/boto/tests/integration/ses/test_connection.py +0 -38
  768. data/packages/gsutil/boto/tests/integration/sns/__init__.py +0 -20
  769. data/packages/gsutil/boto/tests/integration/sns/test_cert_verification.py +0 -40
  770. data/packages/gsutil/boto/tests/integration/sqs/__init__.py +0 -20
  771. data/packages/gsutil/boto/tests/integration/sqs/test_cert_verification.py +0 -40
  772. data/packages/gsutil/boto/tests/integration/sqs/test_connection.py +0 -217
  773. data/packages/gsutil/boto/tests/integration/sts/__init__.py +0 -20
  774. data/packages/gsutil/boto/tests/integration/sts/test_cert_verification.py +0 -40
  775. data/packages/gsutil/boto/tests/integration/sts/test_session_token.py +0 -65
  776. data/packages/gsutil/boto/tests/integration/swf/__init__.py +0 -0
  777. data/packages/gsutil/boto/tests/integration/swf/test_cert_verification.py +0 -40
  778. data/packages/gsutil/boto/tests/integration/swf/test_layer1.py +0 -246
  779. data/packages/gsutil/boto/tests/integration/swf/test_layer1_workflow_execution.py +0 -173
  780. data/packages/gsutil/boto/tests/mturk/__init__.py +0 -0
  781. data/packages/gsutil/boto/tests/mturk/_init_environment.py +0 -28
  782. data/packages/gsutil/boto/tests/mturk/all_tests.py +0 -24
  783. data/packages/gsutil/boto/tests/mturk/cleanup_tests.py +0 -47
  784. data/packages/gsutil/boto/tests/mturk/common.py +0 -45
  785. data/packages/gsutil/boto/tests/mturk/create_free_text_question_regex.doctest +0 -100
  786. data/packages/gsutil/boto/tests/mturk/create_hit.doctest +0 -92
  787. data/packages/gsutil/boto/tests/mturk/create_hit_binary.doctest +0 -94
  788. data/packages/gsutil/boto/tests/mturk/create_hit_external.py +0 -21
  789. data/packages/gsutil/boto/tests/mturk/create_hit_from_hit_type.doctest +0 -103
  790. data/packages/gsutil/boto/tests/mturk/create_hit_test.py +0 -21
  791. data/packages/gsutil/boto/tests/mturk/create_hit_with_qualifications.py +0 -16
  792. data/packages/gsutil/boto/tests/mturk/hit_persistence.py +0 -27
  793. data/packages/gsutil/boto/tests/mturk/mocks.py +0 -11
  794. data/packages/gsutil/boto/tests/mturk/reviewable_hits.doctest +0 -129
  795. data/packages/gsutil/boto/tests/mturk/run-doctest.py +0 -13
  796. data/packages/gsutil/boto/tests/mturk/search_hits.doctest +0 -16
  797. data/packages/gsutil/boto/tests/mturk/selenium_support.py +0 -61
  798. data/packages/gsutil/boto/tests/mturk/support.py +0 -7
  799. data/packages/gsutil/boto/tests/mturk/test_disable_hit.py +0 -11
  800. data/packages/gsutil/boto/tests/test.py +0 -59
  801. data/packages/gsutil/boto/tests/unit/__init__.py +0 -79
  802. data/packages/gsutil/boto/tests/unit/auth/__init__.py +0 -0
  803. data/packages/gsutil/boto/tests/unit/auth/test_sigv4.py +0 -73
  804. data/packages/gsutil/boto/tests/unit/beanstalk/__init__.py +0 -0
  805. data/packages/gsutil/boto/tests/unit/beanstalk/test_layer1.py +0 -128
  806. data/packages/gsutil/boto/tests/unit/cloudformation/__init__.py +0 -0
  807. data/packages/gsutil/boto/tests/unit/cloudformation/test_connection.py +0 -605
  808. data/packages/gsutil/boto/tests/unit/cloudformation/test_stack.py +0 -63
  809. data/packages/gsutil/boto/tests/unit/cloudfront/__init__.py +0 -0
  810. data/packages/gsutil/boto/tests/unit/cloudfront/test_invalidation_list.py +0 -113
  811. data/packages/gsutil/boto/tests/unit/cloudfront/test_signed_urls.py +0 -354
  812. data/packages/gsutil/boto/tests/unit/cloudsearch/__init__.py +0 -1
  813. data/packages/gsutil/boto/tests/unit/cloudsearch/test_connection.py +0 -241
  814. data/packages/gsutil/boto/tests/unit/cloudsearch/test_document.py +0 -324
  815. data/packages/gsutil/boto/tests/unit/cloudsearch/test_search.py +0 -325
  816. data/packages/gsutil/boto/tests/unit/dynamodb/__init__.py +0 -0
  817. data/packages/gsutil/boto/tests/unit/dynamodb/test_batch.py +0 -103
  818. data/packages/gsutil/boto/tests/unit/dynamodb/test_layer2.py +0 -119
  819. data/packages/gsutil/boto/tests/unit/dynamodb/test_types.py +0 -82
  820. data/packages/gsutil/boto/tests/unit/ec2/__init__.py +0 -0
  821. data/packages/gsutil/boto/tests/unit/ec2/autoscale/__init__.py +0 -0
  822. data/packages/gsutil/boto/tests/unit/ec2/autoscale/test_group.py +0 -162
  823. data/packages/gsutil/boto/tests/unit/ec2/test_address.py +0 -39
  824. data/packages/gsutil/boto/tests/unit/ec2/test_blockdevicemapping.py +0 -79
  825. data/packages/gsutil/boto/tests/unit/ec2/test_connection.py +0 -480
  826. data/packages/gsutil/boto/tests/unit/ec2/test_instance.py +0 -243
  827. data/packages/gsutil/boto/tests/unit/ec2/test_networkinterface.py +0 -140
  828. data/packages/gsutil/boto/tests/unit/ec2/test_volume.py +0 -248
  829. data/packages/gsutil/boto/tests/unit/emr/test_emr_responses.py +0 -373
  830. data/packages/gsutil/boto/tests/unit/glacier/__init__.py +0 -0
  831. data/packages/gsutil/boto/tests/unit/glacier/test_concurrent.py +0 -120
  832. data/packages/gsutil/boto/tests/unit/glacier/test_job.py +0 -60
  833. data/packages/gsutil/boto/tests/unit/glacier/test_layer1.py +0 -98
  834. data/packages/gsutil/boto/tests/unit/glacier/test_layer2.py +0 -266
  835. data/packages/gsutil/boto/tests/unit/glacier/test_utils.py +0 -116
  836. data/packages/gsutil/boto/tests/unit/glacier/test_vault.py +0 -100
  837. data/packages/gsutil/boto/tests/unit/glacier/test_writer.py +0 -185
  838. data/packages/gsutil/boto/tests/unit/provider/__init__.py +0 -0
  839. data/packages/gsutil/boto/tests/unit/provider/test_provider.py +0 -176
  840. data/packages/gsutil/boto/tests/unit/rds/__init__.py +0 -0
  841. data/packages/gsutil/boto/tests/unit/rds/test_connection.py +0 -131
  842. data/packages/gsutil/boto/tests/unit/s3/__init__.py +0 -0
  843. data/packages/gsutil/boto/tests/unit/s3/test_cors_configuration.py +0 -77
  844. data/packages/gsutil/boto/tests/unit/s3/test_key.py +0 -75
  845. data/packages/gsutil/boto/tests/unit/s3/test_keyfile.py +0 -101
  846. data/packages/gsutil/boto/tests/unit/s3/test_lifecycle.py +0 -97
  847. data/packages/gsutil/boto/tests/unit/s3/test_tagging.py +0 -47
  848. data/packages/gsutil/boto/tests/unit/s3/test_uri.py +0 -257
  849. data/packages/gsutil/boto/tests/unit/s3/test_website.py +0 -188
  850. data/packages/gsutil/boto/tests/unit/sns/__init__.py +0 -0
  851. data/packages/gsutil/boto/tests/unit/sns/test_connection.py +0 -99
  852. data/packages/gsutil/boto/tests/unit/sqs/__init__.py +0 -0
  853. data/packages/gsutil/boto/tests/unit/sqs/test_connection.py +0 -98
  854. data/packages/gsutil/boto/tests/unit/sqs/test_queue.py +0 -40
  855. data/packages/gsutil/boto/tests/unit/sts/test_connection.py +0 -74
  856. data/packages/gsutil/boto/tests/unit/test_connection.py +0 -60
  857. data/packages/gsutil/boto/tests/unit/utils/test_utils.py +0 -109
  858. data/packages/gsutil/boto/tox.ini +0 -8
  859. data/packages/gsutil/gslib/README +0 -5
  860. data/packages/gsutil/gslib/__init__.py +0 -22
  861. data/packages/gsutil/gslib/__init__.pyc +0 -0
  862. data/packages/gsutil/gslib/addlhelp/acls.py +0 -234
  863. data/packages/gsutil/gslib/addlhelp/anon.py +0 -57
  864. data/packages/gsutil/gslib/addlhelp/command_opts.py +0 -116
  865. data/packages/gsutil/gslib/addlhelp/dev.py +0 -139
  866. data/packages/gsutil/gslib/addlhelp/metadata.py +0 -186
  867. data/packages/gsutil/gslib/addlhelp/naming.py +0 -173
  868. data/packages/gsutil/gslib/addlhelp/prod.py +0 -160
  869. data/packages/gsutil/gslib/addlhelp/projects.py +0 -130
  870. data/packages/gsutil/gslib/addlhelp/subdirs.py +0 -110
  871. data/packages/gsutil/gslib/addlhelp/support.py +0 -86
  872. data/packages/gsutil/gslib/addlhelp/versioning.py +0 -242
  873. data/packages/gsutil/gslib/addlhelp/wildcards.py +0 -170
  874. data/packages/gsutil/gslib/bucket_listing_ref.py +0 -175
  875. data/packages/gsutil/gslib/bucket_listing_ref.pyc +0 -0
  876. data/packages/gsutil/gslib/command.py +0 -722
  877. data/packages/gsutil/gslib/command.pyc +0 -0
  878. data/packages/gsutil/gslib/command_runner.py +0 -101
  879. data/packages/gsutil/gslib/command_runner.pyc +0 -0
  880. data/packages/gsutil/gslib/commands/__init__.pyc +0 -0
  881. data/packages/gsutil/gslib/commands/cat.py +0 -131
  882. data/packages/gsutil/gslib/commands/cat.pyc +0 -0
  883. data/packages/gsutil/gslib/commands/chacl.py +0 -532
  884. data/packages/gsutil/gslib/commands/chacl.pyc +0 -0
  885. data/packages/gsutil/gslib/commands/config.py +0 -694
  886. data/packages/gsutil/gslib/commands/config.pyc +0 -0
  887. data/packages/gsutil/gslib/commands/cp.py +0 -1818
  888. data/packages/gsutil/gslib/commands/cp.pyc +0 -0
  889. data/packages/gsutil/gslib/commands/disablelogging.py +0 -101
  890. data/packages/gsutil/gslib/commands/disablelogging.pyc +0 -0
  891. data/packages/gsutil/gslib/commands/enablelogging.py +0 -149
  892. data/packages/gsutil/gslib/commands/enablelogging.pyc +0 -0
  893. data/packages/gsutil/gslib/commands/getacl.py +0 -82
  894. data/packages/gsutil/gslib/commands/getacl.pyc +0 -0
  895. data/packages/gsutil/gslib/commands/getcors.py +0 -121
  896. data/packages/gsutil/gslib/commands/getcors.pyc +0 -0
  897. data/packages/gsutil/gslib/commands/getdefacl.py +0 -86
  898. data/packages/gsutil/gslib/commands/getdefacl.pyc +0 -0
  899. data/packages/gsutil/gslib/commands/getlogging.py +0 -137
  900. data/packages/gsutil/gslib/commands/getlogging.pyc +0 -0
  901. data/packages/gsutil/gslib/commands/getversioning.py +0 -116
  902. data/packages/gsutil/gslib/commands/getversioning.pyc +0 -0
  903. data/packages/gsutil/gslib/commands/getwebcfg.py +0 -122
  904. data/packages/gsutil/gslib/commands/getwebcfg.pyc +0 -0
  905. data/packages/gsutil/gslib/commands/help.py +0 -218
  906. data/packages/gsutil/gslib/commands/help.pyc +0 -0
  907. data/packages/gsutil/gslib/commands/ls.py +0 -578
  908. data/packages/gsutil/gslib/commands/ls.pyc +0 -0
  909. data/packages/gsutil/gslib/commands/mb.py +0 -172
  910. data/packages/gsutil/gslib/commands/mb.pyc +0 -0
  911. data/packages/gsutil/gslib/commands/mv.py +0 -159
  912. data/packages/gsutil/gslib/commands/mv.pyc +0 -0
  913. data/packages/gsutil/gslib/commands/perfdiag.py +0 -903
  914. data/packages/gsutil/gslib/commands/perfdiag.pyc +0 -0
  915. data/packages/gsutil/gslib/commands/rb.py +0 -113
  916. data/packages/gsutil/gslib/commands/rb.pyc +0 -0
  917. data/packages/gsutil/gslib/commands/rm.py +0 -239
  918. data/packages/gsutil/gslib/commands/rm.pyc +0 -0
  919. data/packages/gsutil/gslib/commands/setacl.py +0 -138
  920. data/packages/gsutil/gslib/commands/setacl.pyc +0 -0
  921. data/packages/gsutil/gslib/commands/setcors.py +0 -145
  922. data/packages/gsutil/gslib/commands/setcors.pyc +0 -0
  923. data/packages/gsutil/gslib/commands/setdefacl.py +0 -105
  924. data/packages/gsutil/gslib/commands/setdefacl.pyc +0 -0
  925. data/packages/gsutil/gslib/commands/setmeta.py +0 -428
  926. data/packages/gsutil/gslib/commands/setmeta.pyc +0 -0
  927. data/packages/gsutil/gslib/commands/setversioning.py +0 -114
  928. data/packages/gsutil/gslib/commands/setversioning.pyc +0 -0
  929. data/packages/gsutil/gslib/commands/setwebcfg.py +0 -190
  930. data/packages/gsutil/gslib/commands/setwebcfg.pyc +0 -0
  931. data/packages/gsutil/gslib/commands/test.py +0 -228
  932. data/packages/gsutil/gslib/commands/test.pyc +0 -0
  933. data/packages/gsutil/gslib/commands/update.py +0 -305
  934. data/packages/gsutil/gslib/commands/update.pyc +0 -0
  935. data/packages/gsutil/gslib/commands/version.py +0 -150
  936. data/packages/gsutil/gslib/commands/version.pyc +0 -0
  937. data/packages/gsutil/gslib/exception.py +0 -76
  938. data/packages/gsutil/gslib/exception.pyc +0 -0
  939. data/packages/gsutil/gslib/help_provider.py +0 -81
  940. data/packages/gsutil/gslib/help_provider.pyc +0 -0
  941. data/packages/gsutil/gslib/name_expansion.py +0 -550
  942. data/packages/gsutil/gslib/name_expansion.pyc +0 -0
  943. data/packages/gsutil/gslib/plurality_checkable_iterator.py +0 -56
  944. data/packages/gsutil/gslib/plurality_checkable_iterator.pyc +0 -0
  945. data/packages/gsutil/gslib/project_id.py +0 -67
  946. data/packages/gsutil/gslib/project_id.pyc +0 -0
  947. data/packages/gsutil/gslib/storage_uri_builder.py +0 -56
  948. data/packages/gsutil/gslib/storage_uri_builder.pyc +0 -0
  949. data/packages/gsutil/gslib/tests/__init__.pyc +0 -0
  950. data/packages/gsutil/gslib/tests/test_chacl.py +0 -236
  951. data/packages/gsutil/gslib/tests/test_cp.py +0 -267
  952. data/packages/gsutil/gslib/tests/test_data/test.gif +0 -0
  953. data/packages/gsutil/gslib/tests/test_data/test.mp3 +0 -0
  954. data/packages/gsutil/gslib/tests/test_ls.py +0 -66
  955. data/packages/gsutil/gslib/tests/test_mv.py +0 -69
  956. data/packages/gsutil/gslib/tests/test_naming.py +0 -989
  957. data/packages/gsutil/gslib/tests/test_perfdiag.py +0 -41
  958. data/packages/gsutil/gslib/tests/test_plurality_checkable_iterator.py +0 -67
  959. data/packages/gsutil/gslib/tests/test_rm.py +0 -143
  960. data/packages/gsutil/gslib/tests/test_setacl.py +0 -152
  961. data/packages/gsutil/gslib/tests/test_setcors.py +0 -168
  962. data/packages/gsutil/gslib/tests/test_setmeta.py +0 -91
  963. data/packages/gsutil/gslib/tests/test_setversioning.py +0 -44
  964. data/packages/gsutil/gslib/tests/test_setwebcfg.py +0 -63
  965. data/packages/gsutil/gslib/tests/test_thread_pool.py +0 -92
  966. data/packages/gsutil/gslib/tests/test_wildcard_iterator.py +0 -364
  967. data/packages/gsutil/gslib/tests/testcase/base.py +0 -89
  968. data/packages/gsutil/gslib/tests/testcase/integration_testcase.py +0 -197
  969. data/packages/gsutil/gslib/tests/testcase/unit_testcase.py +0 -230
  970. data/packages/gsutil/gslib/tests/util.py +0 -125
  971. data/packages/gsutil/gslib/tests/util.pyc +0 -0
  972. data/packages/gsutil/gslib/thread_pool.py +0 -79
  973. data/packages/gsutil/gslib/thread_pool.pyc +0 -0
  974. data/packages/gsutil/gslib/util.py +0 -151
  975. data/packages/gsutil/gslib/util.pyc +0 -0
  976. data/packages/gsutil/gslib/wildcard_iterator.py +0 -492
  977. data/packages/gsutil/gslib/wildcard_iterator.pyc +0 -0
  978. data/packages/gsutil/gsutil +0 -377
  979. data/packages/gsutil/gsutil.spec.in +0 -75
  980. data/packages/gsutil/oauth2_plugin/__init__.py +0 -22
  981. data/packages/gsutil/oauth2_plugin/__init__.pyc +0 -0
  982. data/packages/gsutil/oauth2_plugin/oauth2_client.py +0 -642
  983. data/packages/gsutil/oauth2_plugin/oauth2_client.pyc +0 -0
  984. data/packages/gsutil/oauth2_plugin/oauth2_client_test.py +0 -374
  985. data/packages/gsutil/oauth2_plugin/oauth2_helper.py +0 -110
  986. data/packages/gsutil/oauth2_plugin/oauth2_helper.pyc +0 -0
  987. data/packages/gsutil/oauth2_plugin/oauth2_plugin.py +0 -24
  988. data/packages/gsutil/oauth2_plugin/oauth2_plugin.pyc +0 -0
  989. data/packages/gsutil/pkg_gen.sh +0 -54
  990. data/packages/gsutil/pkg_util.py +0 -60
  991. data/packages/gsutil/setup.py +0 -141
  992. data/packages/gsutil/third_party/__init__.py +0 -0
  993. data/packages/gsutil/third_party/__init__.pyc +0 -0
  994. data/packages/gsutil/third_party/fancy_urllib/README +0 -21
  995. data/packages/gsutil/third_party/fancy_urllib/__init__.py +0 -398
  996. data/packages/gsutil/third_party/fancy_urllib/__init__.pyc +0 -0
  997. data/tasks/rubygem.rake +0 -31
  998. metadata.gz.sig +0 -0
@@ -1,151 +0,0 @@
1
- # Copyright 2012 Google Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- """Commands for interacting with Google Compute Engine availability zones."""
16
-
17
-
18
-
19
- import iso8601
20
-
21
- from google.apputils import appcommands
22
- import gflags as flags
23
-
24
- from gcutil import command_base
25
-
26
-
27
- FLAGS = flags.FLAGS
28
-
29
-
30
- class ZoneCommand(command_base.GoogleComputeCommand):
31
- """Base command for working with the zones collection."""
32
-
33
- default_sort_field = 'name'
34
- summary_fields = (('name', 'name'),
35
- ('description', 'description'),
36
- ('status', 'status'),
37
- ('next-maintenance-window', 'next_maintenance_window'))
38
-
39
- detail_fields = (('name', 'name'),
40
- ('description', 'description'),
41
- ('creation-time', 'creationTimestamp'),
42
- ('status', 'status'))
43
-
44
- def SetApi(self, api):
45
- """Set the Google Compute Engine API for the command.
46
-
47
- Args:
48
- api: The Google Compute Engine API used by this command.
49
-
50
- Returns:
51
- None.
52
- """
53
- self._zones_api = api.zones()
54
- if self._IsUsingAtLeastApiVersion('v1beta14'):
55
- self.summary_fields = (
56
- ('name', 'name'),
57
- ('description', 'description'),
58
- ('status', 'status'),
59
- ('next-maintenance-window', 'next_maintenance_window'),
60
- ('instances-usage', 'instances'),
61
- ('cpus-usage', 'cpus'),
62
- ('disks-usage', 'disks'),
63
- ('disks-total-gb-usage', 'disks_total_gb'))
64
-
65
-
66
- class GetZone(ZoneCommand):
67
- """Get a zone."""
68
-
69
- positional_args = '<zone-name>'
70
-
71
- def CustomizePrintResult(self, result, table):
72
- """Customized result printing for this type.
73
-
74
- Args:
75
- result: json dictionary returned by the server
76
- table: the pretty printing table to be customized
77
-
78
- Returns:
79
- None.
80
-
81
- """
82
- # Add machine types
83
- for (i, m) in enumerate(result.get('availableMachineType', [])):
84
- key = ''
85
- if i == 0:
86
- key = 'machine types'
87
- table.AddRow((key, self._PresentElement(m)))
88
- # Add the maintenance windows
89
- table.AddRow(('maintenance-windows', ''))
90
- for window in result.get('maintenanceWindows', []):
91
- table.AddRow(('', ''))
92
- table.AddRow((' name', window['name']))
93
- table.AddRow((' description', window['description']))
94
- table.AddRow((' begin-time', window['beginTime']))
95
- table.AddRow((' end-time', window['endTime']))
96
- # Add the zone quotas
97
- table.AddRow(('', ''))
98
- table.AddRow(('usage', ''))
99
- for quota in result.get('quotas', []):
100
- table.AddRow((' %s' % quota['metric'].lower().replace('_', '-'),
101
- '%s/%s' % (str(quota['usage']), str(quota['limit']))))
102
-
103
- def Handle(self, zone_name):
104
- """Get the specified zone.
105
-
106
- Args:
107
- zone_name: Path of the zone to get.
108
-
109
- Returns:
110
- The result of getting the zone.
111
- """
112
- request = self._zones_api.get(project=self._project, zone=zone_name)
113
- return request.execute()
114
-
115
-
116
- class ListZones(ZoneCommand, command_base.GoogleComputeListCommand):
117
- """List available zones for a project."""
118
-
119
- def ListFunc(self):
120
- return self._zones_api.list
121
-
122
- def Handle(self):
123
- """List the project's zones."""
124
- result = super(ListZones, self).Handle()
125
- items = result.get('items', [])
126
-
127
- # Add the next maintenance window start time to each entry.
128
- for zone in items:
129
- next_iso = None
130
- next_str = 'None scheduled'
131
-
132
- for window in zone.get('maintenanceWindows', []):
133
- begin_str = window['beginTime']
134
- begin_iso = iso8601.parse_date(begin_str)
135
- if next_iso is None or begin_iso < next_iso:
136
- next_iso = begin_iso
137
- next_str = begin_str
138
-
139
- zone['next_maintenance_window'] = next_str
140
-
141
- for quota in zone.get('quotas', []):
142
- column_name = quota['metric'].lower()
143
- zone[column_name] = (
144
- '%s/%s' % (str(quota['usage']), str(quota['limit'])))
145
-
146
- return result
147
-
148
-
149
- def AddCommands():
150
- appcommands.AddCmd('getzone', GetZone)
151
- appcommands.AddCmd('listzones', ListZones)
@@ -1,60 +0,0 @@
1
- #!/usr/bin/python
2
- #
3
- # Copyright 2012 Google Inc. All Rights Reserved.
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- """Unit tests for the zone commands."""
18
-
19
-
20
-
21
- import path_initializer
22
- path_initializer.InitializeSysPath()
23
-
24
- import copy
25
-
26
- import gflags as flags
27
- import unittest
28
-
29
- from gcutil import command_base
30
- from gcutil import mock_api
31
- from gcutil import zone_cmds
32
-
33
- FLAGS = flags.FLAGS
34
-
35
-
36
- class ZoneCmdsTest(unittest.TestCase):
37
-
38
- def testGetZoneGeneratesCorrectRequest(self):
39
- flag_values = copy.deepcopy(FLAGS)
40
-
41
- command = zone_cmds.GetZone('getzone', flag_values)
42
-
43
- expected_jurisdiction = 'test_jurisdiction'
44
- expected_region = 'test_region'
45
- expected_zone = 'z'
46
- submitted_full_zone = '%s-%s-%s' % (expected_jurisdiction,
47
- expected_region,
48
- expected_zone)
49
- flag_values.service_version = command_base.CURRENT_VERSION
50
-
51
- command.SetFlags(flag_values)
52
- command.SetApi(mock_api.MockApi())
53
-
54
- result = command.Handle(submitted_full_zone)
55
-
56
- self.assertEqual(result['zone'], submitted_full_zone)
57
-
58
-
59
- if __name__ == '__main__':
60
- unittest.main()
@@ -1,21 +0,0 @@
1
- Copyright (c) 2006 by Joe Gregorio
2
-
3
- Permission is hereby granted, free of charge, to any person
4
- obtaining a copy of this software and associated documentation
5
- files (the "Software"), to deal in the Software without restriction,
6
- including without limitation the rights to use, copy, modify, merge,
7
- publish, distribute, sublicense, and/or sell copies of the Software,
8
- and to permit persons to whom the Software is furnished to do so,
9
- subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18
- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19
- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,1630 +0,0 @@
1
- from __future__ import generators
2
- """
3
- httplib2
4
-
5
- A caching http interface that supports ETags and gzip
6
- to conserve bandwidth.
7
-
8
- Requires Python 2.3 or later
9
-
10
- Changelog:
11
- 2007-08-18, Rick: Modified so it's able to use a socks proxy if needed.
12
-
13
- """
14
-
15
- __author__ = "Joe Gregorio (joe@bitworking.org)"
16
- __copyright__ = "Copyright 2006, Joe Gregorio"
17
- __contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)",
18
- "James Antill",
19
- "Xavier Verges Farrero",
20
- "Jonathan Feinberg",
21
- "Blair Zajac",
22
- "Sam Ruby",
23
- "Louis Nyffenegger"]
24
- __license__ = "MIT"
25
- __version__ = "0.7.4"
26
-
27
- import re
28
- import sys
29
- import email
30
- import email.Utils
31
- import email.Message
32
- import email.FeedParser
33
- import StringIO
34
- import gzip
35
- import zlib
36
- import httplib
37
- import urlparse
38
- import urllib
39
- import base64
40
- import os
41
- import copy
42
- import calendar
43
- import time
44
- import random
45
- import errno
46
- try:
47
- from hashlib import sha1 as _sha, md5 as _md5
48
- except ImportError:
49
- # prior to Python 2.5, these were separate modules
50
- import sha
51
- import md5
52
- _sha = sha.new
53
- _md5 = md5.new
54
- import hmac
55
- from gettext import gettext as _
56
- import socket
57
-
58
- try:
59
- from httplib2 import socks
60
- except ImportError:
61
- try:
62
- import socks
63
- except ImportError:
64
- socks = None
65
-
66
- # Build the appropriate socket wrapper for ssl
67
- try:
68
- import ssl # python 2.6
69
- ssl_SSLError = ssl.SSLError
70
- def _ssl_wrap_socket(sock, key_file, cert_file,
71
- disable_validation, ca_certs):
72
- if disable_validation:
73
- cert_reqs = ssl.CERT_NONE
74
- else:
75
- cert_reqs = ssl.CERT_REQUIRED
76
- # We should be specifying SSL version 3 or TLS v1, but the ssl module
77
- # doesn't expose the necessary knobs. So we need to go with the default
78
- # of SSLv23.
79
- return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
80
- cert_reqs=cert_reqs, ca_certs=ca_certs)
81
- except (AttributeError, ImportError):
82
- ssl_SSLError = None
83
- def _ssl_wrap_socket(sock, key_file, cert_file,
84
- disable_validation, ca_certs):
85
- if not disable_validation:
86
- raise CertificateValidationUnsupported(
87
- "SSL certificate validation is not supported without "
88
- "the ssl module installed. To avoid this error, install "
89
- "the ssl module, or explicity disable validation.")
90
- ssl_sock = socket.ssl(sock, key_file, cert_file)
91
- return httplib.FakeSocket(sock, ssl_sock)
92
-
93
-
94
- if sys.version_info >= (2,3):
95
- from iri2uri import iri2uri
96
- else:
97
- def iri2uri(uri):
98
- return uri
99
-
100
- def has_timeout(timeout): # python 2.6
101
- if hasattr(socket, '_GLOBAL_DEFAULT_TIMEOUT'):
102
- return (timeout is not None and timeout is not socket._GLOBAL_DEFAULT_TIMEOUT)
103
- return (timeout is not None)
104
-
105
- __all__ = ['Http', 'Response', 'ProxyInfo', 'HttpLib2Error',
106
- 'RedirectMissingLocation', 'RedirectLimit', 'FailedToDecompressContent',
107
- 'UnimplementedDigestAuthOptionError', 'UnimplementedHmacDigestAuthOptionError',
108
- 'debuglevel', 'ProxiesUnavailableError']
109
-
110
-
111
- # The httplib debug level, set to a non-zero value to get debug output
112
- debuglevel = 0
113
-
114
-
115
- # Python 2.3 support
116
- if sys.version_info < (2,4):
117
- def sorted(seq):
118
- seq.sort()
119
- return seq
120
-
121
- # Python 2.3 support
122
- def HTTPResponse__getheaders(self):
123
- """Return list of (header, value) tuples."""
124
- if self.msg is None:
125
- raise httplib.ResponseNotReady()
126
- return self.msg.items()
127
-
128
- if not hasattr(httplib.HTTPResponse, 'getheaders'):
129
- httplib.HTTPResponse.getheaders = HTTPResponse__getheaders
130
-
131
- # All exceptions raised here derive from HttpLib2Error
132
- class HttpLib2Error(Exception): pass
133
-
134
- # Some exceptions can be caught and optionally
135
- # be turned back into responses.
136
- class HttpLib2ErrorWithResponse(HttpLib2Error):
137
- def __init__(self, desc, response, content):
138
- self.response = response
139
- self.content = content
140
- HttpLib2Error.__init__(self, desc)
141
-
142
- class RedirectMissingLocation(HttpLib2ErrorWithResponse): pass
143
- class RedirectLimit(HttpLib2ErrorWithResponse): pass
144
- class FailedToDecompressContent(HttpLib2ErrorWithResponse): pass
145
- class UnimplementedDigestAuthOptionError(HttpLib2ErrorWithResponse): pass
146
- class UnimplementedHmacDigestAuthOptionError(HttpLib2ErrorWithResponse): pass
147
-
148
- class MalformedHeader(HttpLib2Error): pass
149
- class RelativeURIError(HttpLib2Error): pass
150
- class ServerNotFoundError(HttpLib2Error): pass
151
- class ProxiesUnavailableError(HttpLib2Error): pass
152
- class CertificateValidationUnsupported(HttpLib2Error): pass
153
- class SSLHandshakeError(HttpLib2Error): pass
154
- class NotSupportedOnThisPlatform(HttpLib2Error): pass
155
- class CertificateHostnameMismatch(SSLHandshakeError):
156
- def __init__(self, desc, host, cert):
157
- HttpLib2Error.__init__(self, desc)
158
- self.host = host
159
- self.cert = cert
160
-
161
- # Open Items:
162
- # -----------
163
- # Proxy support
164
-
165
- # Are we removing the cached content too soon on PUT (only delete on 200 Maybe?)
166
-
167
- # Pluggable cache storage (supports storing the cache in
168
- # flat files by default. We need a plug-in architecture
169
- # that can support Berkeley DB and Squid)
170
-
171
- # == Known Issues ==
172
- # Does not handle a resource that uses conneg and Last-Modified but no ETag as a cache validator.
173
- # Does not handle Cache-Control: max-stale
174
- # Does not use Age: headers when calculating cache freshness.
175
-
176
-
177
- # The number of redirections to follow before giving up.
178
- # Note that only GET redirects are automatically followed.
179
- # Will also honor 301 requests by saving that info and never
180
- # requesting that URI again.
181
- DEFAULT_MAX_REDIRECTS = 5
182
-
183
- # Default CA certificates file bundled with httplib2.
184
- CA_CERTS = os.path.join(
185
- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
186
-
187
- # Which headers are hop-by-hop headers by default
188
- HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
189
-
190
- def _get_end2end_headers(response):
191
- hopbyhop = list(HOP_BY_HOP)
192
- hopbyhop.extend([x.strip() for x in response.get('connection', '').split(',')])
193
- return [header for header in response.keys() if header not in hopbyhop]
194
-
195
- URI = re.compile(r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?")
196
-
197
- def parse_uri(uri):
198
- """Parses a URI using the regex given in Appendix B of RFC 3986.
199
-
200
- (scheme, authority, path, query, fragment) = parse_uri(uri)
201
- """
202
- groups = URI.match(uri).groups()
203
- return (groups[1], groups[3], groups[4], groups[6], groups[8])
204
-
205
- def urlnorm(uri):
206
- (scheme, authority, path, query, fragment) = parse_uri(uri)
207
- if not scheme or not authority:
208
- raise RelativeURIError("Only absolute URIs are allowed. uri = %s" % uri)
209
- authority = authority.lower()
210
- scheme = scheme.lower()
211
- if not path:
212
- path = "/"
213
- # Could do syntax based normalization of the URI before
214
- # computing the digest. See Section 6.2.2 of Std 66.
215
- request_uri = query and "?".join([path, query]) or path
216
- scheme = scheme.lower()
217
- defrag_uri = scheme + "://" + authority + request_uri
218
- return scheme, authority, request_uri, defrag_uri
219
-
220
-
221
- # Cache filename construction (original borrowed from Venus http://intertwingly.net/code/venus/)
222
- re_url_scheme = re.compile(r'^\w+://')
223
- re_slash = re.compile(r'[?/:|]+')
224
-
225
- def safename(filename):
226
- """Return a filename suitable for the cache.
227
-
228
- Strips dangerous and common characters to create a filename we
229
- can use to store the cache in.
230
- """
231
-
232
- try:
233
- if re_url_scheme.match(filename):
234
- if isinstance(filename,str):
235
- filename = filename.decode('utf-8')
236
- filename = filename.encode('idna')
237
- else:
238
- filename = filename.encode('idna')
239
- except UnicodeError:
240
- pass
241
- if isinstance(filename,unicode):
242
- filename=filename.encode('utf-8')
243
- filemd5 = _md5(filename).hexdigest()
244
- filename = re_url_scheme.sub("", filename)
245
- filename = re_slash.sub(",", filename)
246
-
247
- # limit length of filename
248
- if len(filename)>200:
249
- filename=filename[:200]
250
- return ",".join((filename, filemd5))
251
-
252
- NORMALIZE_SPACE = re.compile(r'(?:\r\n)?[ \t]+')
253
- def _normalize_headers(headers):
254
- return dict([ (key.lower(), NORMALIZE_SPACE.sub(value, ' ').strip()) for (key, value) in headers.iteritems()])
255
-
256
- def _parse_cache_control(headers):
257
- retval = {}
258
- if headers.has_key('cache-control'):
259
- parts = headers['cache-control'].split(',')
260
- parts_with_args = [tuple([x.strip().lower() for x in part.split("=", 1)]) for part in parts if -1 != part.find("=")]
261
- parts_wo_args = [(name.strip().lower(), 1) for name in parts if -1 == name.find("=")]
262
- retval = dict(parts_with_args + parts_wo_args)
263
- return retval
264
-
265
- # Whether to use a strict mode to parse WWW-Authenticate headers
266
- # Might lead to bad results in case of ill-formed header value,
267
- # so disabled by default, falling back to relaxed parsing.
268
- # Set to true to turn on, usefull for testing servers.
269
- USE_WWW_AUTH_STRICT_PARSING = 0
270
-
271
- # In regex below:
272
- # [^\0-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+ matches a "token" as defined by HTTP
273
- # "(?:[^\0-\x08\x0A-\x1f\x7f-\xff\\\"]|\\[\0-\x7f])*?" matches a "quoted-string" as defined by HTTP, when LWS have already been replaced by a single space
274
- # Actually, as an auth-param value can be either a token or a quoted-string, they are combined in a single pattern which matches both:
275
- # \"?((?<=\")(?:[^\0-\x1f\x7f-\xff\\\"]|\\[\0-\x7f])*?(?=\")|(?<!\")[^\0-\x08\x0A-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+(?!\"))\"?
276
- WWW_AUTH_STRICT = re.compile(r"^(?:\s*(?:,\s*)?([^\0-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+)\s*=\s*\"?((?<=\")(?:[^\0-\x08\x0A-\x1f\x7f-\xff\\\"]|\\[\0-\x7f])*?(?=\")|(?<!\")[^\0-\x1f\x7f-\xff()<>@,;:\\\"/[\]?={} \t]+(?!\"))\"?)(.*)$")
277
- WWW_AUTH_RELAXED = re.compile(r"^(?:\s*(?:,\s*)?([^ \t\r\n=]+)\s*=\s*\"?((?<=\")(?:[^\\\"]|\\.)*?(?=\")|(?<!\")[^ \t\r\n,]+(?!\"))\"?)(.*)$")
278
- UNQUOTE_PAIRS = re.compile(r'\\(.)')
279
- def _parse_www_authenticate(headers, headername='www-authenticate'):
280
- """Returns a dictionary of dictionaries, one dict
281
- per auth_scheme."""
282
- retval = {}
283
- if headers.has_key(headername):
284
- try:
285
- authenticate = headers[headername].strip()
286
- www_auth = USE_WWW_AUTH_STRICT_PARSING and WWW_AUTH_STRICT or WWW_AUTH_RELAXED
287
- while authenticate:
288
- # Break off the scheme at the beginning of the line
289
- if headername == 'authentication-info':
290
- (auth_scheme, the_rest) = ('digest', authenticate)
291
- else:
292
- (auth_scheme, the_rest) = authenticate.split(" ", 1)
293
- # Now loop over all the key value pairs that come after the scheme,
294
- # being careful not to roll into the next scheme
295
- match = www_auth.search(the_rest)
296
- auth_params = {}
297
- while match:
298
- if match and len(match.groups()) == 3:
299
- (key, value, the_rest) = match.groups()
300
- auth_params[key.lower()] = UNQUOTE_PAIRS.sub(r'\1', value) # '\\'.join([x.replace('\\', '') for x in value.split('\\\\')])
301
- match = www_auth.search(the_rest)
302
- retval[auth_scheme.lower()] = auth_params
303
- authenticate = the_rest.strip()
304
- except ValueError:
305
- raise MalformedHeader("WWW-Authenticate")
306
- return retval
307
-
308
-
309
- def _entry_disposition(response_headers, request_headers):
310
- """Determine freshness from the Date, Expires and Cache-Control headers.
311
-
312
- We don't handle the following:
313
-
314
- 1. Cache-Control: max-stale
315
- 2. Age: headers are not used in the calculations.
316
-
317
- Not that this algorithm is simpler than you might think
318
- because we are operating as a private (non-shared) cache.
319
- This lets us ignore 's-maxage'. We can also ignore
320
- 'proxy-invalidate' since we aren't a proxy.
321
- We will never return a stale document as
322
- fresh as a design decision, and thus the non-implementation
323
- of 'max-stale'. This also lets us safely ignore 'must-revalidate'
324
- since we operate as if every server has sent 'must-revalidate'.
325
- Since we are private we get to ignore both 'public' and
326
- 'private' parameters. We also ignore 'no-transform' since
327
- we don't do any transformations.
328
- The 'no-store' parameter is handled at a higher level.
329
- So the only Cache-Control parameters we look at are:
330
-
331
- no-cache
332
- only-if-cached
333
- max-age
334
- min-fresh
335
- """
336
-
337
- retval = "STALE"
338
- cc = _parse_cache_control(request_headers)
339
- cc_response = _parse_cache_control(response_headers)
340
-
341
- if request_headers.has_key('pragma') and request_headers['pragma'].lower().find('no-cache') != -1:
342
- retval = "TRANSPARENT"
343
- if 'cache-control' not in request_headers:
344
- request_headers['cache-control'] = 'no-cache'
345
- elif cc.has_key('no-cache'):
346
- retval = "TRANSPARENT"
347
- elif cc_response.has_key('no-cache'):
348
- retval = "STALE"
349
- elif cc.has_key('only-if-cached'):
350
- retval = "FRESH"
351
- elif response_headers.has_key('date'):
352
- date = calendar.timegm(email.Utils.parsedate_tz(response_headers['date']))
353
- now = time.time()
354
- current_age = max(0, now - date)
355
- if cc_response.has_key('max-age'):
356
- try:
357
- freshness_lifetime = int(cc_response['max-age'])
358
- except ValueError:
359
- freshness_lifetime = 0
360
- elif response_headers.has_key('expires'):
361
- expires = email.Utils.parsedate_tz(response_headers['expires'])
362
- if None == expires:
363
- freshness_lifetime = 0
364
- else:
365
- freshness_lifetime = max(0, calendar.timegm(expires) - date)
366
- else:
367
- freshness_lifetime = 0
368
- if cc.has_key('max-age'):
369
- try:
370
- freshness_lifetime = int(cc['max-age'])
371
- except ValueError:
372
- freshness_lifetime = 0
373
- if cc.has_key('min-fresh'):
374
- try:
375
- min_fresh = int(cc['min-fresh'])
376
- except ValueError:
377
- min_fresh = 0
378
- current_age += min_fresh
379
- if freshness_lifetime > current_age:
380
- retval = "FRESH"
381
- return retval
382
-
383
- def _decompressContent(response, new_content):
384
- content = new_content
385
- try:
386
- encoding = response.get('content-encoding', None)
387
- if encoding in ['gzip', 'deflate']:
388
- if encoding == 'gzip':
389
- content = gzip.GzipFile(fileobj=StringIO.StringIO(new_content)).read()
390
- if encoding == 'deflate':
391
- content = zlib.decompress(content)
392
- response['content-length'] = str(len(content))
393
- # Record the historical presence of the encoding in a way the won't interfere.
394
- response['-content-encoding'] = response['content-encoding']
395
- del response['content-encoding']
396
- except IOError:
397
- content = ""
398
- raise FailedToDecompressContent(_("Content purported to be compressed with %s but failed to decompress.") % response.get('content-encoding'), response, content)
399
- return content
400
-
401
- def _updateCache(request_headers, response_headers, content, cache, cachekey):
402
- if cachekey:
403
- cc = _parse_cache_control(request_headers)
404
- cc_response = _parse_cache_control(response_headers)
405
- if cc.has_key('no-store') or cc_response.has_key('no-store'):
406
- cache.delete(cachekey)
407
- else:
408
- info = email.Message.Message()
409
- for key, value in response_headers.iteritems():
410
- if key not in ['status','content-encoding','transfer-encoding']:
411
- info[key] = value
412
-
413
- # Add annotations to the cache to indicate what headers
414
- # are variant for this request.
415
- vary = response_headers.get('vary', None)
416
- if vary:
417
- vary_headers = vary.lower().replace(' ', '').split(',')
418
- for header in vary_headers:
419
- key = '-varied-%s' % header
420
- try:
421
- info[key] = request_headers[header]
422
- except KeyError:
423
- pass
424
-
425
- status = response_headers.status
426
- if status == 304:
427
- status = 200
428
-
429
- status_header = 'status: %d\r\n' % status
430
-
431
- header_str = info.as_string()
432
-
433
- header_str = re.sub("\r(?!\n)|(?<!\r)\n", "\r\n", header_str)
434
- text = "".join([status_header, header_str, content])
435
-
436
- cache.set(cachekey, text)
437
-
438
- def _cnonce():
439
- dig = _md5("%s:%s" % (time.ctime(), ["0123456789"[random.randrange(0, 9)] for i in range(20)])).hexdigest()
440
- return dig[:16]
441
-
442
- def _wsse_username_token(cnonce, iso_now, password):
443
- return base64.b64encode(_sha("%s%s%s" % (cnonce, iso_now, password)).digest()).strip()
444
-
445
-
446
- # For credentials we need two things, first
447
- # a pool of credential to try (not necesarily tied to BAsic, Digest, etc.)
448
- # Then we also need a list of URIs that have already demanded authentication
449
- # That list is tricky since sub-URIs can take the same auth, or the
450
- # auth scheme may change as you descend the tree.
451
- # So we also need each Auth instance to be able to tell us
452
- # how close to the 'top' it is.
453
-
454
- class Authentication(object):
455
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
456
- (scheme, authority, path, query, fragment) = parse_uri(request_uri)
457
- self.path = path
458
- self.host = host
459
- self.credentials = credentials
460
- self.http = http
461
-
462
- def depth(self, request_uri):
463
- (scheme, authority, path, query, fragment) = parse_uri(request_uri)
464
- return request_uri[len(self.path):].count("/")
465
-
466
- def inscope(self, host, request_uri):
467
- # XXX Should we normalize the request_uri?
468
- (scheme, authority, path, query, fragment) = parse_uri(request_uri)
469
- return (host == self.host) and path.startswith(self.path)
470
-
471
- def request(self, method, request_uri, headers, content):
472
- """Modify the request headers to add the appropriate
473
- Authorization header. Over-rise this in sub-classes."""
474
- pass
475
-
476
- def response(self, response, content):
477
- """Gives us a chance to update with new nonces
478
- or such returned from the last authorized response.
479
- Over-rise this in sub-classes if necessary.
480
-
481
- Return TRUE is the request is to be retried, for
482
- example Digest may return stale=true.
483
- """
484
- return False
485
-
486
-
487
-
488
- class BasicAuthentication(Authentication):
489
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
490
- Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
491
-
492
- def request(self, method, request_uri, headers, content):
493
- """Modify the request headers to add the appropriate
494
- Authorization header."""
495
- headers['authorization'] = 'Basic ' + base64.b64encode("%s:%s" % self.credentials).strip()
496
-
497
-
498
- class DigestAuthentication(Authentication):
499
- """Only do qop='auth' and MD5, since that
500
- is all Apache currently implements"""
501
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
502
- Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
503
- challenge = _parse_www_authenticate(response, 'www-authenticate')
504
- self.challenge = challenge['digest']
505
- qop = self.challenge.get('qop', 'auth')
506
- self.challenge['qop'] = ('auth' in [x.strip() for x in qop.split()]) and 'auth' or None
507
- if self.challenge['qop'] is None:
508
- raise UnimplementedDigestAuthOptionError( _("Unsupported value for qop: %s." % qop))
509
- self.challenge['algorithm'] = self.challenge.get('algorithm', 'MD5').upper()
510
- if self.challenge['algorithm'] != 'MD5':
511
- raise UnimplementedDigestAuthOptionError( _("Unsupported value for algorithm: %s." % self.challenge['algorithm']))
512
- self.A1 = "".join([self.credentials[0], ":", self.challenge['realm'], ":", self.credentials[1]])
513
- self.challenge['nc'] = 1
514
-
515
- def request(self, method, request_uri, headers, content, cnonce = None):
516
- """Modify the request headers"""
517
- H = lambda x: _md5(x).hexdigest()
518
- KD = lambda s, d: H("%s:%s" % (s, d))
519
- A2 = "".join([method, ":", request_uri])
520
- self.challenge['cnonce'] = cnonce or _cnonce()
521
- request_digest = '"%s"' % KD(H(self.A1), "%s:%s:%s:%s:%s" % (self.challenge['nonce'],
522
- '%08x' % self.challenge['nc'],
523
- self.challenge['cnonce'],
524
- self.challenge['qop'], H(A2)
525
- ))
526
- headers['authorization'] = 'Digest username="%s", realm="%s", nonce="%s", uri="%s", algorithm=%s, response=%s, qop=%s, nc=%08x, cnonce="%s"' % (
527
- self.credentials[0],
528
- self.challenge['realm'],
529
- self.challenge['nonce'],
530
- request_uri,
531
- self.challenge['algorithm'],
532
- request_digest,
533
- self.challenge['qop'],
534
- self.challenge['nc'],
535
- self.challenge['cnonce'],
536
- )
537
- if self.challenge.get('opaque'):
538
- headers['authorization'] += ', opaque="%s"' % self.challenge['opaque']
539
- self.challenge['nc'] += 1
540
-
541
- def response(self, response, content):
542
- if not response.has_key('authentication-info'):
543
- challenge = _parse_www_authenticate(response, 'www-authenticate').get('digest', {})
544
- if 'true' == challenge.get('stale'):
545
- self.challenge['nonce'] = challenge['nonce']
546
- self.challenge['nc'] = 1
547
- return True
548
- else:
549
- updated_challenge = _parse_www_authenticate(response, 'authentication-info').get('digest', {})
550
-
551
- if updated_challenge.has_key('nextnonce'):
552
- self.challenge['nonce'] = updated_challenge['nextnonce']
553
- self.challenge['nc'] = 1
554
- return False
555
-
556
-
557
- class HmacDigestAuthentication(Authentication):
558
- """Adapted from Robert Sayre's code and DigestAuthentication above."""
559
- __author__ = "Thomas Broyer (t.broyer@ltgt.net)"
560
-
561
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
562
- Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
563
- challenge = _parse_www_authenticate(response, 'www-authenticate')
564
- self.challenge = challenge['hmacdigest']
565
- # TODO: self.challenge['domain']
566
- self.challenge['reason'] = self.challenge.get('reason', 'unauthorized')
567
- if self.challenge['reason'] not in ['unauthorized', 'integrity']:
568
- self.challenge['reason'] = 'unauthorized'
569
- self.challenge['salt'] = self.challenge.get('salt', '')
570
- if not self.challenge.get('snonce'):
571
- raise UnimplementedHmacDigestAuthOptionError( _("The challenge doesn't contain a server nonce, or this one is empty."))
572
- self.challenge['algorithm'] = self.challenge.get('algorithm', 'HMAC-SHA-1')
573
- if self.challenge['algorithm'] not in ['HMAC-SHA-1', 'HMAC-MD5']:
574
- raise UnimplementedHmacDigestAuthOptionError( _("Unsupported value for algorithm: %s." % self.challenge['algorithm']))
575
- self.challenge['pw-algorithm'] = self.challenge.get('pw-algorithm', 'SHA-1')
576
- if self.challenge['pw-algorithm'] not in ['SHA-1', 'MD5']:
577
- raise UnimplementedHmacDigestAuthOptionError( _("Unsupported value for pw-algorithm: %s." % self.challenge['pw-algorithm']))
578
- if self.challenge['algorithm'] == 'HMAC-MD5':
579
- self.hashmod = _md5
580
- else:
581
- self.hashmod = _sha
582
- if self.challenge['pw-algorithm'] == 'MD5':
583
- self.pwhashmod = _md5
584
- else:
585
- self.pwhashmod = _sha
586
- self.key = "".join([self.credentials[0], ":",
587
- self.pwhashmod.new("".join([self.credentials[1], self.challenge['salt']])).hexdigest().lower(),
588
- ":", self.challenge['realm']
589
- ])
590
- self.key = self.pwhashmod.new(self.key).hexdigest().lower()
591
-
592
- def request(self, method, request_uri, headers, content):
593
- """Modify the request headers"""
594
- keys = _get_end2end_headers(headers)
595
- keylist = "".join(["%s " % k for k in keys])
596
- headers_val = "".join([headers[k] for k in keys])
597
- created = time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime())
598
- cnonce = _cnonce()
599
- request_digest = "%s:%s:%s:%s:%s" % (method, request_uri, cnonce, self.challenge['snonce'], headers_val)
600
- request_digest = hmac.new(self.key, request_digest, self.hashmod).hexdigest().lower()
601
- headers['authorization'] = 'HMACDigest username="%s", realm="%s", snonce="%s", cnonce="%s", uri="%s", created="%s", response="%s", headers="%s"' % (
602
- self.credentials[0],
603
- self.challenge['realm'],
604
- self.challenge['snonce'],
605
- cnonce,
606
- request_uri,
607
- created,
608
- request_digest,
609
- keylist,
610
- )
611
-
612
- def response(self, response, content):
613
- challenge = _parse_www_authenticate(response, 'www-authenticate').get('hmacdigest', {})
614
- if challenge.get('reason') in ['integrity', 'stale']:
615
- return True
616
- return False
617
-
618
-
619
- class WsseAuthentication(Authentication):
620
- """This is thinly tested and should not be relied upon.
621
- At this time there isn't any third party server to test against.
622
- Blogger and TypePad implemented this algorithm at one point
623
- but Blogger has since switched to Basic over HTTPS and
624
- TypePad has implemented it wrong, by never issuing a 401
625
- challenge but instead requiring your client to telepathically know that
626
- their endpoint is expecting WSSE profile="UsernameToken"."""
627
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
628
- Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
629
-
630
- def request(self, method, request_uri, headers, content):
631
- """Modify the request headers to add the appropriate
632
- Authorization header."""
633
- headers['authorization'] = 'WSSE profile="UsernameToken"'
634
- iso_now = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
635
- cnonce = _cnonce()
636
- password_digest = _wsse_username_token(cnonce, iso_now, self.credentials[1])
637
- headers['X-WSSE'] = 'UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"' % (
638
- self.credentials[0],
639
- password_digest,
640
- cnonce,
641
- iso_now)
642
-
643
- class GoogleLoginAuthentication(Authentication):
644
- def __init__(self, credentials, host, request_uri, headers, response, content, http):
645
- from urllib import urlencode
646
- Authentication.__init__(self, credentials, host, request_uri, headers, response, content, http)
647
- challenge = _parse_www_authenticate(response, 'www-authenticate')
648
- service = challenge['googlelogin'].get('service', 'xapi')
649
- # Bloggger actually returns the service in the challenge
650
- # For the rest we guess based on the URI
651
- if service == 'xapi' and request_uri.find("calendar") > 0:
652
- service = "cl"
653
- # No point in guessing Base or Spreadsheet
654
- #elif request_uri.find("spreadsheets") > 0:
655
- # service = "wise"
656
-
657
- auth = dict(Email=credentials[0], Passwd=credentials[1], service=service, source=headers['user-agent'])
658
- resp, content = self.http.request("https://www.google.com/accounts/ClientLogin", method="POST", body=urlencode(auth), headers={'Content-Type': 'application/x-www-form-urlencoded'})
659
- lines = content.split('\n')
660
- d = dict([tuple(line.split("=", 1)) for line in lines if line])
661
- if resp.status == 403:
662
- self.Auth = ""
663
- else:
664
- self.Auth = d['Auth']
665
-
666
- def request(self, method, request_uri, headers, content):
667
- """Modify the request headers to add the appropriate
668
- Authorization header."""
669
- headers['authorization'] = 'GoogleLogin Auth=' + self.Auth
670
-
671
-
672
- AUTH_SCHEME_CLASSES = {
673
- "basic": BasicAuthentication,
674
- "wsse": WsseAuthentication,
675
- "digest": DigestAuthentication,
676
- "hmacdigest": HmacDigestAuthentication,
677
- "googlelogin": GoogleLoginAuthentication
678
- }
679
-
680
- AUTH_SCHEME_ORDER = ["hmacdigest", "googlelogin", "digest", "wsse", "basic"]
681
-
682
- class FileCache(object):
683
- """Uses a local directory as a store for cached files.
684
- Not really safe to use if multiple threads or processes are going to
685
- be running on the same cache.
686
- """
687
- def __init__(self, cache, safe=safename): # use safe=lambda x: md5.new(x).hexdigest() for the old behavior
688
- self.cache = cache
689
- self.safe = safe
690
- if not os.path.exists(cache):
691
- os.makedirs(self.cache)
692
-
693
- def get(self, key):
694
- retval = None
695
- cacheFullPath = os.path.join(self.cache, self.safe(key))
696
- try:
697
- f = file(cacheFullPath, "rb")
698
- retval = f.read()
699
- f.close()
700
- except IOError:
701
- pass
702
- return retval
703
-
704
- def set(self, key, value):
705
- cacheFullPath = os.path.join(self.cache, self.safe(key))
706
- f = file(cacheFullPath, "wb")
707
- f.write(value)
708
- f.close()
709
-
710
- def delete(self, key):
711
- cacheFullPath = os.path.join(self.cache, self.safe(key))
712
- if os.path.exists(cacheFullPath):
713
- os.remove(cacheFullPath)
714
-
715
- class Credentials(object):
716
- def __init__(self):
717
- self.credentials = []
718
-
719
- def add(self, name, password, domain=""):
720
- self.credentials.append((domain.lower(), name, password))
721
-
722
- def clear(self):
723
- self.credentials = []
724
-
725
- def iter(self, domain):
726
- for (cdomain, name, password) in self.credentials:
727
- if cdomain == "" or domain == cdomain:
728
- yield (name, password)
729
-
730
- class KeyCerts(Credentials):
731
- """Identical to Credentials except that
732
- name/password are mapped to key/cert."""
733
- pass
734
-
735
- class AllHosts(object):
736
- pass
737
-
738
- class ProxyInfo(object):
739
- """Collect information required to use a proxy."""
740
- bypass_hosts = ()
741
-
742
- def __init__(self, proxy_type, proxy_host, proxy_port,
743
- proxy_rdns=None, proxy_user=None, proxy_pass=None):
744
- """The parameter proxy_type must be set to one of socks.PROXY_TYPE_XXX
745
- constants. For example:
746
-
747
- p = ProxyInfo(proxy_type=socks.PROXY_TYPE_HTTP,
748
- proxy_host='localhost', proxy_port=8000)
749
- """
750
- self.proxy_type = proxy_type
751
- self.proxy_host = proxy_host
752
- self.proxy_port = proxy_port
753
- self.proxy_rdns = proxy_rdns
754
- self.proxy_user = proxy_user
755
- self.proxy_pass = proxy_pass
756
-
757
- def astuple(self):
758
- return (self.proxy_type, self.proxy_host, self.proxy_port,
759
- self.proxy_rdns, self.proxy_user, self.proxy_pass)
760
-
761
- def isgood(self):
762
- return (self.proxy_host != None) and (self.proxy_port != None)
763
-
764
- @classmethod
765
- def from_environment(cls, method='http'):
766
- """
767
- Read proxy info from the environment variables.
768
- """
769
- if method not in ['http', 'https']:
770
- return
771
-
772
- env_var = method + '_proxy'
773
- url = os.environ.get(env_var, os.environ.get(env_var.upper()))
774
- if not url:
775
- return
776
- pi = cls.from_url(url, method)
777
-
778
- no_proxy = os.environ.get('no_proxy', os.environ.get('NO_PROXY', ''))
779
- bypass_hosts = []
780
- if no_proxy:
781
- bypass_hosts = no_proxy.split(',')
782
- # special case, no_proxy=* means all hosts bypassed
783
- if no_proxy == '*':
784
- bypass_hosts = AllHosts
785
-
786
- pi.bypass_hosts = bypass_hosts
787
- return pi
788
-
789
- @classmethod
790
- def from_url(cls, url, method='http'):
791
- """
792
- Construct a ProxyInfo from a URL (such as http_proxy env var)
793
- """
794
- url = urlparse.urlparse(url)
795
- username = None
796
- password = None
797
- port = None
798
- if '@' in url[1]:
799
- ident, host_port = url[1].split('@', 1)
800
- if ':' in ident:
801
- username, password = ident.split(':', 1)
802
- else:
803
- password = ident
804
- else:
805
- host_port = url[1]
806
- if ':' in host_port:
807
- host, port = host_port.split(':', 1)
808
- else:
809
- host = host_port
810
-
811
- if port:
812
- port = int(port)
813
- else:
814
- port = dict(https=443, http=80)[method]
815
-
816
- proxy_type = 3 # socks.PROXY_TYPE_HTTP
817
- return cls(
818
- proxy_type = proxy_type,
819
- proxy_host = host,
820
- proxy_port = port,
821
- proxy_user = username or None,
822
- proxy_pass = password or None,
823
- )
824
-
825
- def applies_to(self, hostname):
826
- return not self.bypass_host(hostname)
827
-
828
- def bypass_host(self, hostname):
829
- """Has this host been excluded from the proxy config"""
830
- if self.bypass_hosts is AllHosts:
831
- return True
832
-
833
- bypass = False
834
- for domain in self.bypass_hosts:
835
- if hostname.endswith(domain):
836
- bypass = True
837
-
838
- return bypass
839
-
840
-
841
- class HTTPConnectionWithTimeout(httplib.HTTPConnection):
842
- """
843
- HTTPConnection subclass that supports timeouts
844
-
845
- All timeouts are in seconds. If None is passed for timeout then
846
- Python's default timeout for sockets will be used. See for example
847
- the docs of socket.setdefaulttimeout():
848
- http://docs.python.org/library/socket.html#socket.setdefaulttimeout
849
- """
850
-
851
- def __init__(self, host, port=None, strict=None, timeout=None, proxy_info=None):
852
- httplib.HTTPConnection.__init__(self, host, port, strict)
853
- self.timeout = timeout
854
- self.proxy_info = proxy_info
855
-
856
- def connect(self):
857
- """Connect to the host and port specified in __init__."""
858
- # Mostly verbatim from httplib.py.
859
- if self.proxy_info and socks is None:
860
- raise ProxiesUnavailableError(
861
- 'Proxy support missing but proxy use was requested!')
862
- msg = "getaddrinfo returns an empty list"
863
- for res in socket.getaddrinfo(self.host, self.port, 0,
864
- socket.SOCK_STREAM):
865
- af, socktype, proto, canonname, sa = res
866
- try:
867
- if self.proxy_info and self.proxy_info.isgood():
868
- self.sock = socks.socksocket(af, socktype, proto)
869
- self.sock.setproxy(*self.proxy_info.astuple())
870
- else:
871
- self.sock = socket.socket(af, socktype, proto)
872
- self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
873
- # Different from httplib: support timeouts.
874
- if has_timeout(self.timeout):
875
- self.sock.settimeout(self.timeout)
876
- # End of difference from httplib.
877
- if self.debuglevel > 0:
878
- print "connect: (%s, %s)" % (self.host, self.port)
879
-
880
- self.sock.connect((self.host, self.port) + sa[2:])
881
- except socket.error, msg:
882
- if self.debuglevel > 0:
883
- print 'connect fail:', (self.host, self.port)
884
- if self.sock:
885
- self.sock.close()
886
- self.sock = None
887
- continue
888
- break
889
- if not self.sock:
890
- raise socket.error, msg
891
-
892
- class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
893
- """
894
- This class allows communication via SSL.
895
-
896
- All timeouts are in seconds. If None is passed for timeout then
897
- Python's default timeout for sockets will be used. See for example
898
- the docs of socket.setdefaulttimeout():
899
- http://docs.python.org/library/socket.html#socket.setdefaulttimeout
900
- """
901
- def __init__(self, host, port=None, key_file=None, cert_file=None,
902
- strict=None, timeout=None, proxy_info=None,
903
- ca_certs=None, disable_ssl_certificate_validation=False):
904
- httplib.HTTPSConnection.__init__(self, host, port=port, key_file=key_file,
905
- cert_file=cert_file, strict=strict)
906
- self.timeout = timeout
907
- self.proxy_info = proxy_info
908
- if ca_certs is None:
909
- ca_certs = CA_CERTS
910
- self.ca_certs = ca_certs
911
- self.disable_ssl_certificate_validation = \
912
- disable_ssl_certificate_validation
913
-
914
- # The following two methods were adapted from https_wrapper.py, released
915
- # with the Google Appengine SDK at
916
- # http://googleappengine.googlecode.com/svn-history/r136/trunk/python/google/appengine/tools/https_wrapper.py
917
- # under the following license:
918
- #
919
- # Copyright 2007 Google Inc.
920
- #
921
- # Licensed under the Apache License, Version 2.0 (the "License");
922
- # you may not use this file except in compliance with the License.
923
- # You may obtain a copy of the License at
924
- #
925
- # http://www.apache.org/licenses/LICENSE-2.0
926
- #
927
- # Unless required by applicable law or agreed to in writing, software
928
- # distributed under the License is distributed on an "AS IS" BASIS,
929
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
930
- # See the License for the specific language governing permissions and
931
- # limitations under the License.
932
- #
933
-
934
- def _GetValidHostsForCert(self, cert):
935
- """Returns a list of valid host globs for an SSL certificate.
936
-
937
- Args:
938
- cert: A dictionary representing an SSL certificate.
939
- Returns:
940
- list: A list of valid host globs.
941
- """
942
- if 'subjectAltName' in cert:
943
- return [x[1] for x in cert['subjectAltName']
944
- if x[0].lower() == 'dns']
945
- else:
946
- return [x[0][1] for x in cert['subject']
947
- if x[0][0].lower() == 'commonname']
948
-
949
- def _ValidateCertificateHostname(self, cert, hostname):
950
- """Validates that a given hostname is valid for an SSL certificate.
951
-
952
- Args:
953
- cert: A dictionary representing an SSL certificate.
954
- hostname: The hostname to test.
955
- Returns:
956
- bool: Whether or not the hostname is valid for this certificate.
957
- """
958
- hosts = self._GetValidHostsForCert(cert)
959
- for host in hosts:
960
- host_re = host.replace('.', '\.').replace('*', '[^.]*')
961
- if re.search('^%s$' % (host_re,), hostname, re.I):
962
- return True
963
- return False
964
-
965
- def connect(self):
966
- "Connect to a host on a given (SSL) port."
967
-
968
- msg = "getaddrinfo returns an empty list"
969
- for family, socktype, proto, canonname, sockaddr in socket.getaddrinfo(
970
- self.host, self.port, 0, socket.SOCK_STREAM):
971
- try:
972
- if self.proxy_info and self.proxy_info.isgood():
973
- sock = socks.socksocket(family, socktype, proto)
974
- sock.setproxy(*self.proxy_info.astuple())
975
- else:
976
- sock = socket.socket(family, socktype, proto)
977
- sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
978
-
979
- if has_timeout(self.timeout):
980
- sock.settimeout(self.timeout)
981
- sock.connect((self.host, self.port))
982
- self.sock =_ssl_wrap_socket(
983
- sock, self.key_file, self.cert_file,
984
- self.disable_ssl_certificate_validation, self.ca_certs)
985
- if self.debuglevel > 0:
986
- print "connect: (%s, %s)" % (self.host, self.port)
987
- if not self.disable_ssl_certificate_validation:
988
- cert = self.sock.getpeercert()
989
- hostname = self.host.split(':', 0)[0]
990
- if not self._ValidateCertificateHostname(cert, hostname):
991
- raise CertificateHostnameMismatch(
992
- 'Server presented certificate that does not match '
993
- 'host %s: %s' % (hostname, cert), hostname, cert)
994
- except ssl_SSLError, e:
995
- if sock:
996
- sock.close()
997
- if self.sock:
998
- self.sock.close()
999
- self.sock = None
1000
- # Unfortunately the ssl module doesn't seem to provide any way
1001
- # to get at more detailed error information, in particular
1002
- # whether the error is due to certificate validation or
1003
- # something else (such as SSL protocol mismatch).
1004
- if e.errno == ssl.SSL_ERROR_SSL:
1005
- raise SSLHandshakeError(e)
1006
- else:
1007
- raise
1008
- except (socket.timeout, socket.gaierror):
1009
- raise
1010
- except socket.error, msg:
1011
- if self.debuglevel > 0:
1012
- print 'connect fail:', (self.host, self.port)
1013
- if self.sock:
1014
- self.sock.close()
1015
- self.sock = None
1016
- continue
1017
- break
1018
- if not self.sock:
1019
- raise socket.error, msg
1020
-
1021
- SCHEME_TO_CONNECTION = {
1022
- 'http': HTTPConnectionWithTimeout,
1023
- 'https': HTTPSConnectionWithTimeout
1024
- }
1025
-
1026
- # Use a different connection object for Google App Engine
1027
- try:
1028
- from google.appengine.api import apiproxy_stub_map
1029
- if apiproxy_stub_map.apiproxy.GetStub('urlfetch') is None:
1030
- raise ImportError # Bail out; we're not actually running on App Engine.
1031
- from google.appengine.api.urlfetch import fetch
1032
- from google.appengine.api.urlfetch import InvalidURLError
1033
- from google.appengine.api.urlfetch import DownloadError
1034
- from google.appengine.api.urlfetch import ResponseTooLargeError
1035
- from google.appengine.api.urlfetch import SSLCertificateError
1036
-
1037
-
1038
- class ResponseDict(dict):
1039
- """Is a dictionary that also has a read() method, so
1040
- that it can pass itself off as an httlib.HTTPResponse()."""
1041
- def read(self):
1042
- pass
1043
-
1044
-
1045
- class AppEngineHttpConnection(object):
1046
- """Emulates an httplib.HTTPConnection object, but actually uses the Google
1047
- App Engine urlfetch library. This allows the timeout to be properly used on
1048
- Google App Engine, and avoids using httplib, which on Google App Engine is
1049
- just another wrapper around urlfetch.
1050
- """
1051
- def __init__(self, host, port=None, key_file=None, cert_file=None,
1052
- strict=None, timeout=None, proxy_info=None, ca_certs=None,
1053
- disable_certificate_validation=False):
1054
- self.host = host
1055
- self.port = port
1056
- self.timeout = timeout
1057
- if key_file or cert_file or proxy_info or ca_certs:
1058
- raise NotSupportedOnThisPlatform()
1059
- self.response = None
1060
- self.scheme = 'http'
1061
- self.validate_certificate = not disable_certificate_validation
1062
- self.sock = True
1063
-
1064
- def request(self, method, url, body, headers):
1065
- # Calculate the absolute URI, which fetch requires
1066
- netloc = self.host
1067
- if self.port:
1068
- netloc = '%s:%s' % (self.host, self.port)
1069
- absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
1070
- try:
1071
- response = fetch(absolute_uri, payload=body, method=method,
1072
- headers=headers, allow_truncated=False, follow_redirects=False,
1073
- deadline=self.timeout,
1074
- validate_certificate=self.validate_certificate)
1075
- self.response = ResponseDict(response.headers)
1076
- self.response['status'] = str(response.status_code)
1077
- self.response.status = response.status_code
1078
- setattr(self.response, 'read', lambda : response.content)
1079
-
1080
- # Make sure the exceptions raised match the exceptions expected.
1081
- except InvalidURLError:
1082
- raise socket.gaierror('')
1083
- except (DownloadError, ResponseTooLargeError, SSLCertificateError):
1084
- raise httplib.HTTPException()
1085
-
1086
- def getresponse(self):
1087
- if self.response:
1088
- return self.response
1089
- else:
1090
- raise httplib.HTTPException()
1091
-
1092
- def set_debuglevel(self, level):
1093
- pass
1094
-
1095
- def connect(self):
1096
- pass
1097
-
1098
- def close(self):
1099
- pass
1100
-
1101
-
1102
- class AppEngineHttpsConnection(AppEngineHttpConnection):
1103
- """Same as AppEngineHttpConnection, but for HTTPS URIs."""
1104
- def __init__(self, host, port=None, key_file=None, cert_file=None,
1105
- strict=None, timeout=None, proxy_info=None):
1106
- AppEngineHttpConnection.__init__(self, host, port, key_file, cert_file,
1107
- strict, timeout, proxy_info)
1108
- self.scheme = 'https'
1109
-
1110
- # Update the connection classes to use the Googel App Engine specific ones.
1111
- SCHEME_TO_CONNECTION = {
1112
- 'http': AppEngineHttpConnection,
1113
- 'https': AppEngineHttpsConnection
1114
- }
1115
-
1116
- except ImportError:
1117
- pass
1118
-
1119
-
1120
- class Http(object):
1121
- """An HTTP client that handles:
1122
- - all methods
1123
- - caching
1124
- - ETags
1125
- - compression,
1126
- - HTTPS
1127
- - Basic
1128
- - Digest
1129
- - WSSE
1130
-
1131
- and more.
1132
- """
1133
- def __init__(self, cache=None, timeout=None,
1134
- proxy_info=ProxyInfo.from_environment,
1135
- ca_certs=None, disable_ssl_certificate_validation=False):
1136
- """
1137
- If 'cache' is a string then it is used as a directory name for
1138
- a disk cache. Otherwise it must be an object that supports the
1139
- same interface as FileCache.
1140
-
1141
- All timeouts are in seconds. If None is passed for timeout
1142
- then Python's default timeout for sockets will be used. See
1143
- for example the docs of socket.setdefaulttimeout():
1144
- http://docs.python.org/library/socket.html#socket.setdefaulttimeout
1145
-
1146
- `proxy_info` may be:
1147
- - a callable that takes the http scheme ('http' or 'https') and
1148
- returns a ProxyInfo instance per request. By default, uses
1149
- ProxyInfo.from_environment.
1150
- - a ProxyInfo instance (static proxy config).
1151
- - None (proxy disabled).
1152
-
1153
- ca_certs is the path of a file containing root CA certificates for SSL
1154
- server certificate validation. By default, a CA cert file bundled with
1155
- httplib2 is used.
1156
-
1157
- If disable_ssl_certificate_validation is true, SSL cert validation will
1158
- not be performed.
1159
- """
1160
- self.proxy_info = proxy_info
1161
- self.ca_certs = ca_certs
1162
- self.disable_ssl_certificate_validation = \
1163
- disable_ssl_certificate_validation
1164
-
1165
- # Map domain name to an httplib connection
1166
- self.connections = {}
1167
- # The location of the cache, for now a directory
1168
- # where cached responses are held.
1169
- if cache and isinstance(cache, basestring):
1170
- self.cache = FileCache(cache)
1171
- else:
1172
- self.cache = cache
1173
-
1174
- # Name/password
1175
- self.credentials = Credentials()
1176
-
1177
- # Key/cert
1178
- self.certificates = KeyCerts()
1179
-
1180
- # authorization objects
1181
- self.authorizations = []
1182
-
1183
- # If set to False then no redirects are followed, even safe ones.
1184
- self.follow_redirects = True
1185
-
1186
- # Which HTTP methods do we apply optimistic concurrency to, i.e.
1187
- # which methods get an "if-match:" etag header added to them.
1188
- self.optimistic_concurrency_methods = ["PUT", "PATCH"]
1189
-
1190
- # If 'follow_redirects' is True, and this is set to True then
1191
- # all redirecs are followed, including unsafe ones.
1192
- self.follow_all_redirects = False
1193
-
1194
- self.ignore_etag = False
1195
-
1196
- self.force_exception_to_status_code = False
1197
-
1198
- self.timeout = timeout
1199
-
1200
- def _auth_from_challenge(self, host, request_uri, headers, response, content):
1201
- """A generator that creates Authorization objects
1202
- that can be applied to requests.
1203
- """
1204
- challenges = _parse_www_authenticate(response, 'www-authenticate')
1205
- for cred in self.credentials.iter(host):
1206
- for scheme in AUTH_SCHEME_ORDER:
1207
- if challenges.has_key(scheme):
1208
- yield AUTH_SCHEME_CLASSES[scheme](cred, host, request_uri, headers, response, content, self)
1209
-
1210
- def add_credentials(self, name, password, domain=""):
1211
- """Add a name and password that will be used
1212
- any time a request requires authentication."""
1213
- self.credentials.add(name, password, domain)
1214
-
1215
- def add_certificate(self, key, cert, domain):
1216
- """Add a key and cert that will be used
1217
- any time a request requires authentication."""
1218
- self.certificates.add(key, cert, domain)
1219
-
1220
- def clear_credentials(self):
1221
- """Remove all the names and passwords
1222
- that are used for authentication"""
1223
- self.credentials.clear()
1224
- self.authorizations = []
1225
-
1226
- def _conn_request(self, conn, request_uri, method, body, headers):
1227
- for i in range(2):
1228
- try:
1229
- if conn.sock is None:
1230
- conn.connect()
1231
- conn.request(method, request_uri, body, headers)
1232
- except socket.timeout:
1233
- raise
1234
- except socket.gaierror:
1235
- conn.close()
1236
- raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
1237
- except ssl_SSLError:
1238
- conn.close()
1239
- raise
1240
- except socket.error, e:
1241
- err = 0
1242
- if hasattr(e, 'args'):
1243
- err = getattr(e, 'args')[0]
1244
- else:
1245
- err = e.errno
1246
- if err == errno.ECONNREFUSED: # Connection refused
1247
- raise
1248
- except httplib.HTTPException:
1249
- # Just because the server closed the connection doesn't apparently mean
1250
- # that the server didn't send a response.
1251
- if conn.sock is None:
1252
- if i == 0:
1253
- conn.close()
1254
- conn.connect()
1255
- continue
1256
- else:
1257
- conn.close()
1258
- raise
1259
- if i == 0:
1260
- conn.close()
1261
- conn.connect()
1262
- continue
1263
- try:
1264
- response = conn.getresponse()
1265
- except (socket.error, httplib.HTTPException):
1266
- if i == 0:
1267
- conn.close()
1268
- conn.connect()
1269
- continue
1270
- else:
1271
- raise
1272
- else:
1273
- content = ""
1274
- if method == "HEAD":
1275
- response.close()
1276
- else:
1277
- content = response.read()
1278
- response = Response(response)
1279
- if method != "HEAD":
1280
- content = _decompressContent(response, content)
1281
- break
1282
- return (response, content)
1283
-
1284
-
1285
- def _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey):
1286
- """Do the actual request using the connection object
1287
- and also follow one level of redirects if necessary"""
1288
-
1289
- auths = [(auth.depth(request_uri), auth) for auth in self.authorizations if auth.inscope(host, request_uri)]
1290
- auth = auths and sorted(auths)[0][1] or None
1291
- if auth:
1292
- auth.request(method, request_uri, headers, body)
1293
-
1294
- (response, content) = self._conn_request(conn, request_uri, method, body, headers)
1295
-
1296
- if auth:
1297
- if auth.response(response, body):
1298
- auth.request(method, request_uri, headers, body)
1299
- (response, content) = self._conn_request(conn, request_uri, method, body, headers )
1300
- response._stale_digest = 1
1301
-
1302
- if response.status == 401:
1303
- for authorization in self._auth_from_challenge(host, request_uri, headers, response, content):
1304
- authorization.request(method, request_uri, headers, body)
1305
- (response, content) = self._conn_request(conn, request_uri, method, body, headers, )
1306
- if response.status != 401:
1307
- self.authorizations.append(authorization)
1308
- authorization.response(response, body)
1309
- break
1310
-
1311
- if (self.follow_all_redirects or (method in ["GET", "HEAD"]) or response.status == 303):
1312
- if self.follow_redirects and response.status in [300, 301, 302, 303, 307]:
1313
- # Pick out the location header and basically start from the beginning
1314
- # remembering first to strip the ETag header and decrement our 'depth'
1315
- if redirections:
1316
- if not response.has_key('location') and response.status != 300:
1317
- raise RedirectMissingLocation( _("Redirected but the response is missing a Location: header."), response, content)
1318
- # Fix-up relative redirects (which violate an RFC 2616 MUST)
1319
- if response.has_key('location'):
1320
- location = response['location']
1321
- (scheme, authority, path, query, fragment) = parse_uri(location)
1322
- if authority == None:
1323
- response['location'] = urlparse.urljoin(absolute_uri, location)
1324
- if response.status == 301 and method in ["GET", "HEAD"]:
1325
- response['-x-permanent-redirect-url'] = response['location']
1326
- if not response.has_key('content-location'):
1327
- response['content-location'] = absolute_uri
1328
- _updateCache(headers, response, content, self.cache, cachekey)
1329
- if headers.has_key('if-none-match'):
1330
- del headers['if-none-match']
1331
- if headers.has_key('if-modified-since'):
1332
- del headers['if-modified-since']
1333
- if response.has_key('location'):
1334
- location = response['location']
1335
- old_response = copy.deepcopy(response)
1336
- if not old_response.has_key('content-location'):
1337
- old_response['content-location'] = absolute_uri
1338
- redirect_method = method
1339
- if response.status in [302, 303]:
1340
- redirect_method = "GET"
1341
- body = None
1342
- (response, content) = self.request(location, redirect_method, body=body, headers = headers, redirections = redirections - 1)
1343
- response.previous = old_response
1344
- else:
1345
- raise RedirectLimit("Redirected more times than rediection_limit allows.", response, content)
1346
- elif response.status in [200, 203] and method in ["GET", "HEAD"]:
1347
- # Don't cache 206's since we aren't going to handle byte range requests
1348
- if not response.has_key('content-location'):
1349
- response['content-location'] = absolute_uri
1350
- _updateCache(headers, response, content, self.cache, cachekey)
1351
-
1352
- return (response, content)
1353
-
1354
- def _normalize_headers(self, headers):
1355
- return _normalize_headers(headers)
1356
-
1357
- # Need to catch and rebrand some exceptions
1358
- # Then need to optionally turn all exceptions into status codes
1359
- # including all socket.* and httplib.* exceptions.
1360
-
1361
-
1362
- def request(self, uri, method="GET", body=None, headers=None, redirections=DEFAULT_MAX_REDIRECTS, connection_type=None):
1363
- """ Performs a single HTTP request.
1364
- The 'uri' is the URI of the HTTP resource and can begin
1365
- with either 'http' or 'https'. The value of 'uri' must be an absolute URI.
1366
-
1367
- The 'method' is the HTTP method to perform, such as GET, POST, DELETE, etc.
1368
- There is no restriction on the methods allowed.
1369
-
1370
- The 'body' is the entity body to be sent with the request. It is a string
1371
- object.
1372
-
1373
- Any extra headers that are to be sent with the request should be provided in the
1374
- 'headers' dictionary.
1375
-
1376
- The maximum number of redirect to follow before raising an
1377
- exception is 'redirections. The default is 5.
1378
-
1379
- The return value is a tuple of (response, content), the first
1380
- being and instance of the 'Response' class, the second being
1381
- a string that contains the response entity body.
1382
- """
1383
- try:
1384
- if headers is None:
1385
- headers = {}
1386
- else:
1387
- headers = self._normalize_headers(headers)
1388
-
1389
- if not headers.has_key('user-agent'):
1390
- headers['user-agent'] = "Python-httplib2/%s (gzip)" % __version__
1391
-
1392
- uri = iri2uri(uri)
1393
-
1394
- (scheme, authority, request_uri, defrag_uri) = urlnorm(uri)
1395
- domain_port = authority.split(":")[0:2]
1396
- if len(domain_port) == 2 and domain_port[1] == '443' and scheme == 'http':
1397
- scheme = 'https'
1398
- authority = domain_port[0]
1399
-
1400
- proxy_info = self._get_proxy_info(scheme, authority)
1401
-
1402
- conn_key = scheme+":"+authority
1403
- if conn_key in self.connections:
1404
- conn = self.connections[conn_key]
1405
- else:
1406
- if not connection_type:
1407
- connection_type = SCHEME_TO_CONNECTION[scheme]
1408
- certs = list(self.certificates.iter(authority))
1409
- if issubclass(connection_type, HTTPSConnectionWithTimeout):
1410
- if certs:
1411
- conn = self.connections[conn_key] = connection_type(
1412
- authority, key_file=certs[0][0],
1413
- cert_file=certs[0][1], timeout=self.timeout,
1414
- proxy_info=proxy_info,
1415
- ca_certs=self.ca_certs,
1416
- disable_ssl_certificate_validation=
1417
- self.disable_ssl_certificate_validation)
1418
- else:
1419
- conn = self.connections[conn_key] = connection_type(
1420
- authority, timeout=self.timeout,
1421
- proxy_info=proxy_info,
1422
- ca_certs=self.ca_certs,
1423
- disable_ssl_certificate_validation=
1424
- self.disable_ssl_certificate_validation)
1425
- else:
1426
- conn = self.connections[conn_key] = connection_type(
1427
- authority, timeout=self.timeout,
1428
- proxy_info=proxy_info)
1429
- conn.set_debuglevel(debuglevel)
1430
-
1431
- if 'range' not in headers and 'accept-encoding' not in headers:
1432
- headers['accept-encoding'] = 'gzip, deflate'
1433
-
1434
- info = email.Message.Message()
1435
- cached_value = None
1436
- if self.cache:
1437
- cachekey = defrag_uri
1438
- cached_value = self.cache.get(cachekey)
1439
- if cached_value:
1440
- # info = email.message_from_string(cached_value)
1441
- #
1442
- # Need to replace the line above with the kludge below
1443
- # to fix the non-existent bug not fixed in this
1444
- # bug report: http://mail.python.org/pipermail/python-bugs-list/2005-September/030289.html
1445
- try:
1446
- info, content = cached_value.split('\r\n\r\n', 1)
1447
- feedparser = email.FeedParser.FeedParser()
1448
- feedparser.feed(info)
1449
- info = feedparser.close()
1450
- feedparser._parse = None
1451
- except IndexError:
1452
- self.cache.delete(cachekey)
1453
- cachekey = None
1454
- cached_value = None
1455
- else:
1456
- cachekey = None
1457
-
1458
- if method in self.optimistic_concurrency_methods and self.cache and info.has_key('etag') and not self.ignore_etag and 'if-match' not in headers:
1459
- # http://www.w3.org/1999/04/Editing/
1460
- headers['if-match'] = info['etag']
1461
-
1462
- if method not in ["GET", "HEAD"] and self.cache and cachekey:
1463
- # RFC 2616 Section 13.10
1464
- self.cache.delete(cachekey)
1465
-
1466
- # Check the vary header in the cache to see if this request
1467
- # matches what varies in the cache.
1468
- if method in ['GET', 'HEAD'] and 'vary' in info:
1469
- vary = info['vary']
1470
- vary_headers = vary.lower().replace(' ', '').split(',')
1471
- for header in vary_headers:
1472
- key = '-varied-%s' % header
1473
- value = info[key]
1474
- if headers.get(header, None) != value:
1475
- cached_value = None
1476
- break
1477
-
1478
- if cached_value and method in ["GET", "HEAD"] and self.cache and 'range' not in headers:
1479
- if info.has_key('-x-permanent-redirect-url'):
1480
- # Should cached permanent redirects be counted in our redirection count? For now, yes.
1481
- if redirections <= 0:
1482
- raise RedirectLimit("Redirected more times than rediection_limit allows.", {}, "")
1483
- (response, new_content) = self.request(info['-x-permanent-redirect-url'], "GET", headers = headers, redirections = redirections - 1)
1484
- response.previous = Response(info)
1485
- response.previous.fromcache = True
1486
- else:
1487
- # Determine our course of action:
1488
- # Is the cached entry fresh or stale?
1489
- # Has the client requested a non-cached response?
1490
- #
1491
- # There seems to be three possible answers:
1492
- # 1. [FRESH] Return the cache entry w/o doing a GET
1493
- # 2. [STALE] Do the GET (but add in cache validators if available)
1494
- # 3. [TRANSPARENT] Do a GET w/o any cache validators (Cache-Control: no-cache) on the request
1495
- entry_disposition = _entry_disposition(info, headers)
1496
-
1497
- if entry_disposition == "FRESH":
1498
- if not cached_value:
1499
- info['status'] = '504'
1500
- content = ""
1501
- response = Response(info)
1502
- if cached_value:
1503
- response.fromcache = True
1504
- return (response, content)
1505
-
1506
- if entry_disposition == "STALE":
1507
- if info.has_key('etag') and not self.ignore_etag and not 'if-none-match' in headers:
1508
- headers['if-none-match'] = info['etag']
1509
- if info.has_key('last-modified') and not 'last-modified' in headers:
1510
- headers['if-modified-since'] = info['last-modified']
1511
- elif entry_disposition == "TRANSPARENT":
1512
- pass
1513
-
1514
- (response, new_content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
1515
-
1516
- if response.status == 304 and method == "GET":
1517
- # Rewrite the cache entry with the new end-to-end headers
1518
- # Take all headers that are in response
1519
- # and overwrite their values in info.
1520
- # unless they are hop-by-hop, or are listed in the connection header.
1521
-
1522
- for key in _get_end2end_headers(response):
1523
- info[key] = response[key]
1524
- merged_response = Response(info)
1525
- if hasattr(response, "_stale_digest"):
1526
- merged_response._stale_digest = response._stale_digest
1527
- _updateCache(headers, merged_response, content, self.cache, cachekey)
1528
- response = merged_response
1529
- response.status = 200
1530
- response.fromcache = True
1531
-
1532
- elif response.status == 200:
1533
- content = new_content
1534
- else:
1535
- self.cache.delete(cachekey)
1536
- content = new_content
1537
- else:
1538
- cc = _parse_cache_control(headers)
1539
- if cc.has_key('only-if-cached'):
1540
- info['status'] = '504'
1541
- response = Response(info)
1542
- content = ""
1543
- else:
1544
- (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
1545
- except Exception, e:
1546
- if self.force_exception_to_status_code:
1547
- if isinstance(e, HttpLib2ErrorWithResponse):
1548
- response = e.response
1549
- content = e.content
1550
- response.status = 500
1551
- response.reason = str(e)
1552
- elif isinstance(e, socket.timeout):
1553
- content = "Request Timeout"
1554
- response = Response( {
1555
- "content-type": "text/plain",
1556
- "status": "408",
1557
- "content-length": len(content)
1558
- })
1559
- response.reason = "Request Timeout"
1560
- else:
1561
- content = str(e)
1562
- response = Response( {
1563
- "content-type": "text/plain",
1564
- "status": "400",
1565
- "content-length": len(content)
1566
- })
1567
- response.reason = "Bad Request"
1568
- else:
1569
- raise
1570
-
1571
-
1572
- return (response, content)
1573
-
1574
- def _get_proxy_info(self, scheme, authority):
1575
- """Return a ProxyInfo instance (or None) based on the scheme
1576
- and authority.
1577
- """
1578
- hostname, port = urllib.splitport(authority)
1579
- proxy_info = self.proxy_info
1580
- if callable(proxy_info):
1581
- proxy_info = proxy_info(scheme)
1582
-
1583
- if (hasattr(proxy_info, 'applies_to')
1584
- and not proxy_info.applies_to(hostname)):
1585
- proxy_info = None
1586
- return proxy_info
1587
-
1588
-
1589
- class Response(dict):
1590
- """An object more like email.Message than httplib.HTTPResponse."""
1591
-
1592
- """Is this response from our local cache"""
1593
- fromcache = False
1594
-
1595
- """HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1. """
1596
- version = 11
1597
-
1598
- "Status code returned by server. "
1599
- status = 200
1600
-
1601
- """Reason phrase returned by server."""
1602
- reason = "Ok"
1603
-
1604
- previous = None
1605
-
1606
- def __init__(self, info):
1607
- # info is either an email.Message or
1608
- # an httplib.HTTPResponse object.
1609
- if isinstance(info, httplib.HTTPResponse):
1610
- for key, value in info.getheaders():
1611
- self[key.lower()] = value
1612
- self.status = info.status
1613
- self['status'] = str(self.status)
1614
- self.reason = info.reason
1615
- self.version = info.version
1616
- elif isinstance(info, email.Message.Message):
1617
- for key, value in info.items():
1618
- self[key] = value
1619
- self.status = int(self['status'])
1620
- else:
1621
- for key, value in info.iteritems():
1622
- self[key] = value
1623
- self.status = int(self.get('status', self.status))
1624
-
1625
-
1626
- def __getattr__(self, name):
1627
- if name == 'dict':
1628
- return self
1629
- else:
1630
- raise AttributeError, name