gsutil: Use urllib2 instead of urllib.
This is similar to r247914 and r149742: urllib does not work with SSL
connections behind proxies, we need to use urllib2 instead. Doing this
should allow people behind proxies to download gsutils 4.7 after
r293413.
(Setting NOTRY here to be able to land the issue, otherwise the CQ fails when running some presubmit checks, see crbug.com/443232)
[email protected], [email protected], [email protected], [email protected]
NOTRY=true
Review URL: https://codereview.chromium.org/809053002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293439 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gsutil.py b/gsutil.py
index d383fa7..cd16078 100755
--- a/gsutil.py
+++ b/gsutil.py
@@ -7,15 +7,15 @@
import argparse
-import shutil
-import zipfile
-import hashlib
import base64
-import os
-import sys
+import hashlib
import json
-import urllib
+import os
+import shutil
import subprocess
+import sys
+import urllib2
+import zipfile
GSUTIL_URL = 'https://storage.googleapis.com/pub/'
@@ -67,7 +67,7 @@
local_md5 = md5_calc.hexdigest()
metadata_url = '%s%s' % (API_URL, filename)
- metadata = json.load(urllib.urlopen(metadata_url))
+ metadata = json.load(urllib2.urlopen(metadata_url))
remote_md5 = base64.b64decode(metadata['md5Hash'])
if local_md5 == remote_md5:
@@ -76,7 +76,7 @@
# Do the download.
url = '%s%s' % (GSUTIL_URL, filename)
- u = urllib.urlopen(url)
+ u = urllib2.urlopen(url)
with open(target_filename, 'wb') as f:
while True:
buf = u.read(4096)