mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
[Python] add an option to Config in order to specify safe chars for path parameter (#5628)
This commit is contained in:
parent
11baad6e4b
commit
a7d5684679
@ -90,6 +90,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)
|
||||
@ -106,8 +108,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:
|
||||
|
@ -82,6 +82,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):
|
||||
|
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -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:
|
||||
|
@ -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):
|
||||
|
1
samples/client/petstore/python/.swagger-codegen/VERSION
Normal file
1
samples/client/petstore/python/.swagger-codegen/VERSION
Normal file
@ -0,0 +1 @@
|
||||
2.2.3-SNAPSHOT
|
@ -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:
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user