From 302cde3849f02edeb11ac7ff1a7976e133de2d29 Mon Sep 17 00:00:00 2001 From: fujinhua Date: Mon, 8 Jul 2019 16:45:22 +0800 Subject: Update vnfres from py2 to py3 Change-Id: I959812628fccc50b68cfb104cc4418c0816d434c Issue-ID: VFC-1429 Signed-off-by: fujinhua --- res/res/pub/utils/restcall.py | 4 ++-- res/res/swagger/management/commands/export_swagger.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/res/res/pub/utils/restcall.py b/res/res/pub/utils/restcall.py index 60b9f76..852bf0b 100644 --- a/res/res/pub/utils/restcall.py +++ b/res/res/pub/utils/restcall.py @@ -15,7 +15,7 @@ import sys import traceback import logging -import urllib2 +import urllib import uuid import httplib2 @@ -60,7 +60,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content=''): ret = [1, "Unable to connect to %s" % full_url, resp_status] continue raise ex - except urllib2.URLError as err: + except urllib.error.URLError as err: ret = [2, str(err), resp_status] except Exception as ex: logger.error(traceback.format_exc()) diff --git a/res/res/swagger/management/commands/export_swagger.py b/res/res/swagger/management/commands/export_swagger.py index 8b5274a..930537c 100644 --- a/res/res/swagger/management/commands/export_swagger.py +++ b/res/res/swagger/management/commands/export_swagger.py @@ -33,4 +33,4 @@ class Command(BaseCommand): response = self.client.get("/api/vnfres/v1/swagger.json") with open(options['name'], 'w') as swagger_file: swagger_file.write(json.dumps(response.data)) - print "swagger api is written to %s" % options['name'] + print("swagger api is written to %s" % options['name']) -- cgit 1.2.3-korg