Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: gsutil.py

Issue 809053002: gsutil: Use urllib2 instead of urllib. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Patch v3, update the tests Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/gsutil_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gsutil.py
diff --git a/gsutil.py b/gsutil.py
index e3f50d4687cdc687832b48b33ff21bf7f1341f3a..99587d3c1458a54fae949d8fad05794e35e49e6a 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 @@ def download_gsutil(version, target_dir):
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 @@ def download_gsutil(version, target_dir):
# 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)
« no previous file with comments | « no previous file | tests/gsutil_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698