[Python] add an option to Config in order to specify safe chars for path parameter (#5628)

This commit is contained in:
Takuro Wada
2017-05-14 12:54:26 +09:00
committed by wing328
parent 11baad6e4b
commit a7d5684679
8 changed files with 20 additions and 3 deletions

View File

@@ -99,6 +99,8 @@ class ApiClient(object):
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
config = Configuration()
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
@@ -115,8 +117,9 @@ class ApiClient(object):
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k, quote(str(v), safe='')) # no safe chars, encode everything
'{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param))
# query parameters
if query_params:

View File

@@ -91,6 +91,8 @@ class Configuration(object):
# Proxy URL
self.proxy = None
# Safe chars for path_param
self.safe_chars_for_path_param = ''
@property
def logger_file(self):