Fix the conflict of urlparse between python2 and python3

Change-Id: I5a031b3f076127ca967d07d75af6fe8c60eb5661
Task: 24628
Story: 2003432
This commit is contained in:
hazelnutsgz 2018-10-18 13:33:58 +08:00
parent dfe0ebc08a
commit 0f01a337c7
2 changed files with 10 additions and 4 deletions

View File

@ -14,7 +14,10 @@
#
import logging
import urlparse
try:
from urlparse import urlparse
except ModuleNotFoundError:
from urllib.parse import urlparse
import requests
@ -93,7 +96,7 @@ class Client(object):
def _patching_client(request):
o = urlparse.urlparse(base.url_for(request, 'patching'))
o = urlparse(base.url_for(request, 'patching'))
url = "://".join((o.scheme, o.netloc))
return Client("v1", url, token_id=request.user.token.id)

View File

@ -14,7 +14,10 @@
#
import logging
import urlparse
try:
from urlparse import urlparse
except ModuleNotFoundError:
from urllib.parse import urlparse
from openstack_dashboard.api import base
@ -59,7 +62,7 @@ class Client(object):
def _sw_update_client(request):
o = urlparse.urlparse(base.url_for(request, 'nfv'))
o = urlparse(base.url_for(request, 'nfv'))
url = "://".join((o.scheme, o.netloc))
return Client(url, token_id=request.user.token.id)