Keep py3.X compatibility for urllib

Change-Id: If6c1b016c726070b5b326296ead933cbd74bd408
Partial-Bug:#1280105
This commit is contained in:
Swapnil Kulkarni (coolsvap) 2015-12-24 12:05:37 +05:30
parent 783713efd3
commit d8a34e2d69
1 changed files with 2 additions and 9 deletions

View File

@ -24,7 +24,6 @@ from .rest import ApiException
import os
import re
import urllib
import json
import mimetypes
import random
@ -36,13 +35,7 @@ from datetime import date
# python 2 and python 3 compatibility library
from six import iteritems
try:
# for python3
from urllib.parse import quote
except ImportError:
# for python2
from urllib import quote
from six.moves.urllib import parse as urlparse
from .configuration import Configuration
@ -116,7 +109,7 @@ class ApiClient(object):
if path_params:
path_params = self.sanitize_for_serialization(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.\
replace('{' + k + '}', replacement)