diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java index 4a5af07cf8ba..8f375519d688 100755 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java @@ -59,7 +59,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig setReservedWordsLowerCase( Arrays.asList( // local variable name used in API methods (endpoints) - "all_params", "resource_path", "method", "path_params", "query_params", + "all_params", "resource_path", "path_params", "query_params", "header_params", "form_params", "local_var_files", "body_params", "auth_settings", // python reserved words "and", "del", "from", "not", "while", "as", "elif", "global", "or", "with", diff --git a/modules/swagger-codegen/src/main/resources/python/api.mustache b/modules/swagger-codegen/src/main/resources/python/api.mustache index 9296cb0b0c20..4d8b712a425c 100644 --- a/modules/swagger-codegen/src/main/resources/python/api.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api.mustache @@ -97,8 +97,6 @@ class {{classname}}(object): {{/allParams}} resource_path = '{{path}}'.replace('{format}', 'json') - method = '{{httpMethod}}' - path_params = {} {{#pathParams}} if '{{paramName}}' in params: @@ -143,7 +141,7 @@ class {{classname}}(object): # Authentication setting auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, '{{httpMethod}}', path_params, query_params, header_params, diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index 4a6c7b40a063..5f14852ba779 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -81,8 +81,6 @@ class PetApi(object): resource_path = '/pet'.replace('{format}', 'json') - method = 'PUT' - path_params = {} query_params = {} @@ -109,7 +107,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, @@ -157,8 +155,6 @@ class PetApi(object): resource_path = '/pet'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -185,7 +181,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -233,8 +229,6 @@ class PetApi(object): resource_path = '/pet/findByStatus'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -261,7 +255,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -309,8 +303,6 @@ class PetApi(object): resource_path = '/pet/findByTags'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -337,7 +329,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -388,8 +380,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -416,7 +406,7 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key', 'petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -469,8 +459,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'POST' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -501,7 +489,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -553,8 +541,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") resource_path = '/pet/{petId}'.replace('{format}', 'json') - method = 'DELETE' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -583,7 +569,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, @@ -636,8 +622,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') - method = 'POST' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -668,7 +652,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -719,8 +703,6 @@ class PetApi(object): raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`") resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'pet_id' in params: path_params['petId'] = params['pet_id'] @@ -747,7 +729,7 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key', 'petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -795,8 +777,6 @@ class PetApi(object): resource_path = '/pet?testing_byte_array=true'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -823,7 +803,7 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index b0a60dc4807d..ce524916aa43 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -81,8 +81,6 @@ class StoreApi(object): resource_path = '/store/findByStatus'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -109,7 +107,7 @@ class StoreApi(object): # Authentication setting auth_settings = ['test_api_client_id', 'test_api_client_secret'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -156,8 +154,6 @@ class StoreApi(object): resource_path = '/store/inventory'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -182,7 +178,7 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -230,8 +226,6 @@ class StoreApi(object): resource_path = '/store/order'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -258,7 +252,7 @@ class StoreApi(object): # Authentication setting auth_settings = ['test_api_client_id', 'test_api_client_secret'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -309,8 +303,6 @@ class StoreApi(object): raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") resource_path = '/store/order/{orderId}'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'order_id' in params: path_params['orderId'] = params['order_id'] @@ -337,7 +329,7 @@ class StoreApi(object): # Authentication setting auth_settings = ['test_api_key_header', 'test_api_key_query'] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -388,8 +380,6 @@ class StoreApi(object): raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") resource_path = '/store/order/{orderId}'.replace('{format}', 'json') - method = 'DELETE' - path_params = {} if 'order_id' in params: path_params['orderId'] = params['order_id'] @@ -416,7 +406,7 @@ class StoreApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params, diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 586bc413ba04..a83243cc2459 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -81,8 +81,6 @@ class UserApi(object): resource_path = '/user'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -109,7 +107,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -157,8 +155,6 @@ class UserApi(object): resource_path = '/user/createWithArray'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -185,7 +181,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -233,8 +229,6 @@ class UserApi(object): resource_path = '/user/createWithList'.replace('{format}', 'json') - method = 'POST' - path_params = {} query_params = {} @@ -261,7 +255,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'POST', path_params, query_params, header_params, @@ -310,8 +304,6 @@ class UserApi(object): resource_path = '/user/login'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -340,7 +332,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -387,8 +379,6 @@ class UserApi(object): resource_path = '/user/logout'.replace('{format}', 'json') - method = 'GET' - path_params = {} query_params = {} @@ -413,7 +403,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -464,8 +454,6 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'GET' - path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -492,7 +480,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'GET', path_params, query_params, header_params, @@ -544,8 +532,6 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `update_user`") resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'PUT' - path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -574,7 +560,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'PUT', path_params, query_params, header_params, @@ -625,8 +611,6 @@ class UserApi(object): raise ValueError("Missing the required parameter `username` when calling `delete_user`") resource_path = '/user/{username}'.replace('{format}', 'json') - method = 'DELETE' - path_params = {} if 'username' in params: path_params['username'] = params['username'] @@ -653,7 +637,7 @@ class UserApi(object): # Authentication setting auth_settings = [] - response = self.api_client.call_api(resource_path, method, + response = self.api_client.call_api(resource_path, 'DELETE', path_params, query_params, header_params,