summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2019-07-08 16:45:22 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2019-07-08 16:45:22 +0800
commit302cde3849f02edeb11ac7ff1a7976e133de2d29 (patch)
tree74b9f88023a0b22bded526573ee38373a4c57560
parentdc05639d337bea881f1c6a94027c3c3bb2181b11 (diff)
Update vnfres from py2 to py3
Change-Id: I959812628fccc50b68cfb104cc4418c0816d434c Issue-ID: VFC-1429 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rw-r--r--res/res/pub/utils/restcall.py4
-rw-r--r--res/res/swagger/management/commands/export_swagger.py2
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'])