Keep py3.X compatibility for urllib
Change-Id: If6c1b016c726070b5b326296ead933cbd74bd408 Partial-Bug:#1280105
This commit is contained in:
@@ -24,7 +24,6 @@ from .rest import ApiException
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import urllib
|
|
||||||
import json
|
import json
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import random
|
import random
|
||||||
@@ -36,13 +35,7 @@ from datetime import date
|
|||||||
|
|
||||||
# python 2 and python 3 compatibility library
|
# python 2 and python 3 compatibility library
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
from six.moves.urllib import parse as urlparse
|
||||||
try:
|
|
||||||
# for python3
|
|
||||||
from urllib.parse import quote
|
|
||||||
except ImportError:
|
|
||||||
# for python2
|
|
||||||
from urllib import quote
|
|
||||||
|
|
||||||
from .configuration import Configuration
|
from .configuration import Configuration
|
||||||
|
|
||||||
@@ -116,7 +109,7 @@ class ApiClient(object):
|
|||||||
if path_params:
|
if path_params:
|
||||||
path_params = self.sanitize_for_serialization(path_params)
|
path_params = self.sanitize_for_serialization(path_params)
|
||||||
for k, v in iteritems(path_params):
|
for k, v in iteritems(path_params):
|
||||||
replacement = quote(str(self.to_path_value(v)))
|
replacement = urlparse.quote(str(self.to_path_value(v)))
|
||||||
resource_path = resource_path.\
|
resource_path = resource_path.\
|
||||||
replace('{' + k + '}', replacement)
|
replace('{' + k + '}', replacement)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user