diff --git a/modules/swagger-codegen/src/main/resources/python/config.mustache b/modules/swagger-codegen/src/main/resources/python/config.mustache index 5fb2db2832..928aac21ed 100644 --- a/modules/swagger-codegen/src/main/resources/python/config.mustache +++ b/modules/swagger-codegen/src/main/resources/python/config.mustache @@ -15,8 +15,7 @@ def get_basic_auth_token(): global username global password - if username and password: - return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization') + return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization') def auth_settings(): return { {{#authMethods}}{{#isApiKey}} diff --git a/modules/swagger-codegen/src/main/resources/python/swagger.mustache b/modules/swagger-codegen/src/main/resources/python/swagger.mustache index f01192dd46..0483041116 100644 --- a/modules/swagger-codegen/src/main/resources/python/swagger.mustache +++ b/modules/swagger-codegen/src/main/resources/python/swagger.mustache @@ -62,12 +62,11 @@ class ApiClient(object): body=None, post_params=None, files=None, response=None, auth_settings=None): # headers parameters - headers = self.default_headers.copy() - headers.update(header_params) + headers_params = self.default_headers.copy().update(header_params) if self.cookie: - headers['Cookie'] = self.cookie - if headers: - headers = self.sanitize_for_serialization(headers) + headers_params['Cookie'] = self.cookie + if headers_params: + headers_params = ApiClient.sanitize_for_serialization(headers_params) # path parameters if path_params: @@ -87,7 +86,7 @@ class ApiClient(object): post_params = self.sanitize_for_serialization(post_params) # auth setting - self.update_params_for_auth(headers, query_params, auth_settings) + self.update_params_for_auth(headers_params, query_params, auth_settings) # body if body: @@ -97,7 +96,7 @@ class ApiClient(object): url = self.host + resource_path # perform request and return response - response_data = self.request(method, url, query_params=query_params, headers=headers, + response_data = self.request(method, url, query_params=query_params, headers=headers_params, post_params=post_params, body=body) # deserialize response data diff --git a/samples/client/petstore/python/SwaggerPetstore-python/.coverage b/samples/client/petstore/python/SwaggerPetstore-python/.coverage new file mode 100644 index 0000000000..50a2ec114f Binary files /dev/null and b/samples/client/petstore/python/SwaggerPetstore-python/.coverage differ diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO new file mode 100644 index 0000000000..ade0b73120 --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO @@ -0,0 +1,12 @@ +Metadata-Version: 1.0 +Name: SwaggerPetstore +Version: 1.0.0 +Summary: Swagger Petstore +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: apiteam@wordnik.com +License: UNKNOWN +Description: This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + +Keywords: Swagger,Swagger Petstore +Platform: UNKNOWN diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt new file mode 100644 index 0000000000..94955251c3 --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt @@ -0,0 +1,25 @@ +setup.cfg +setup.py +SwaggerPetstore/__init__.py +SwaggerPetstore/config.py +SwaggerPetstore/rest.py +SwaggerPetstore/swagger.py +SwaggerPetstore/util.py +SwaggerPetstore.egg-info/PKG-INFO +SwaggerPetstore.egg-info/SOURCES.txt +SwaggerPetstore.egg-info/dependency_links.txt +SwaggerPetstore.egg-info/requires.txt +SwaggerPetstore.egg-info/top_level.txt +SwaggerPetstore/apis/__init__.py +SwaggerPetstore/apis/pet_api.py +SwaggerPetstore/apis/store_api.py +SwaggerPetstore/apis/user_api.py +SwaggerPetstore/models/__init__.py +SwaggerPetstore/models/category.py +SwaggerPetstore/models/order.py +SwaggerPetstore/models/pet.py +SwaggerPetstore/models/tag.py +SwaggerPetstore/models/user.py +tests/__init__.py +tests/test_api_client.py +tests/test_pet_api.py \ No newline at end of file diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt new file mode 100644 index 0000000000..cf46870af1 --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt @@ -0,0 +1,2 @@ +urllib3 >= 1.10 +six >= 1.9 \ No newline at end of file diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt new file mode 100644 index 0000000000..58cccc9f2e --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt @@ -0,0 +1,2 @@ +tests +SwaggerPetstore diff --git a/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log b/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log new file mode 100644 index 0000000000..0549f97e65 --- /dev/null +++ b/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log @@ -0,0 +1,5 @@ +Requirement already satisfied (use --upgrade to upgrade): nose in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1)) +Requirement already satisfied (use --upgrade to upgrade): tox in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2)) +Requirement already satisfied (use --upgrade to upgrade): coverage in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3)) +Requirement already satisfied (use --upgrade to upgrade): randomize in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4)) +Cleaning up...