diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index 04b53afba9..dd66481f65 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -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: diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index 47c7db9fba..6c05560466 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -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): diff --git a/samples/client/petstore-security-test/python/.swagger-codegen/VERSION b/samples/client/petstore-security-test/python/.swagger-codegen/VERSION new file mode 100644 index 0000000000..7fea99011a --- /dev/null +++ b/samples/client/petstore-security-test/python/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/python/petstore_api/api_client.py b/samples/client/petstore-security-test/python/petstore_api/api_client.py index 95265e4971..73bbc40eaa 100644 --- a/samples/client/petstore-security-test/python/petstore_api/api_client.py +++ b/samples/client/petstore-security-test/python/petstore_api/api_client.py @@ -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: diff --git a/samples/client/petstore-security-test/python/petstore_api/configuration.py b/samples/client/petstore-security-test/python/petstore_api/configuration.py index 5ee635a908..95c96c912b 100644 --- a/samples/client/petstore-security-test/python/petstore_api/configuration.py +++ b/samples/client/petstore-security-test/python/petstore_api/configuration.py @@ -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): diff --git a/samples/client/petstore/python/.swagger-codegen/VERSION b/samples/client/petstore/python/.swagger-codegen/VERSION new file mode 100644 index 0000000000..7fea99011a --- /dev/null +++ b/samples/client/petstore/python/.swagger-codegen/VERSION @@ -0,0 +1 @@ +2.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index 620bb3e4bc..9764b02ab7 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -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: diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index a5cf1113d0..1e0cc59e2b 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -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):