From 30f38e8dfd876eba20f65b91ad8022c5f7364452 Mon Sep 17 00:00:00 2001 From: "Swapnil Kulkarni (coolsvap)" Date: Thu, 24 Dec 2015 12:18:53 +0530 Subject: [PATCH] Keep py3.X compatibility for urllib Change-Id: I0583071421f2b0a7fb79ea0dbfde52b2c7cb20e0 Partial-Bug:#1280105 --- refstack_client/scripts/prep_cloud.py | 5 +++-- requirements.txt | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/refstack_client/scripts/prep_cloud.py b/refstack_client/scripts/prep_cloud.py index 5b8d05b..618b03c 100644 --- a/refstack_client/scripts/prep_cloud.py +++ b/refstack_client/scripts/prep_cloud.py @@ -26,7 +26,8 @@ import ConfigParser import os import tarfile -import urllib2 + +from six.moves.urllib import request as urlreq # Default client libs import glanceclient as glance_client @@ -296,7 +297,7 @@ def download_and_register_uec_images(image_client, download_url, basename = os.path.basename(download_url) path = os.path.join(download_folder, basename) - request = urllib2.urlopen(download_url) + request = urlreq.urlopen(download_url) # First, download the file with open(path, "wb") as fp: diff --git a/requirements.txt b/requirements.txt index 2b066f0..bf820a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ python-subunit>=0.0.18 pycrypto>=2.6.1 requests>=2.5.2 PyYAML>=3.1.0 +six>=1.9.0