From 654a73c5a8163080cb760fc3d8af5964b0d94cc5 Mon Sep 17 00:00:00 2001 From: geekerzp Date: Wed, 27 May 2015 20:50:04 +0800 Subject: [PATCH] rebuild python client --- .../main/resources/python/swagger.mustache | 14 +++++----- .../python/SwaggerPetstore-python/.coverage | Bin 3297 -> 0 bytes .../SwaggerPetstore.egg-info/PKG-INFO | 12 --------- .../SwaggerPetstore.egg-info/SOURCES.txt | 25 ------------------ .../dependency_links.txt | 1 - .../SwaggerPetstore.egg-info/requires.txt | 2 -- .../SwaggerPetstore.egg-info/top_level.txt | 2 -- .../SwaggerPetstore/config.py | 3 +-- .../SwaggerPetstore/swagger.py | 15 ++++++----- .../dev-requirements.txt.log | 5 ---- 10 files changed, 17 insertions(+), 62 deletions(-) delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/.coverage delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt delete mode 100644 samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log diff --git a/modules/swagger-codegen/src/main/resources/python/swagger.mustache b/modules/swagger-codegen/src/main/resources/python/swagger.mustache index 0483041116..d7b896d3c0 100644 --- a/modules/swagger-codegen/src/main/resources/python/swagger.mustache +++ b/modules/swagger-codegen/src/main/resources/python/swagger.mustache @@ -62,11 +62,12 @@ class ApiClient(object): body=None, post_params=None, files=None, response=None, auth_settings=None): # headers parameters - headers_params = self.default_headers.copy().update(header_params) + header_params = header_params or {} + header_params.update(self.default_headers) if self.cookie: - headers_params['Cookie'] = self.cookie - if headers_params: - headers_params = ApiClient.sanitize_for_serialization(headers_params) + header_params['Cookie'] = self.cookie + if header_params: + header_params = ApiClient.sanitize_for_serialization(header_params) # path parameters if path_params: @@ -86,7 +87,7 @@ class ApiClient(object): post_params = self.sanitize_for_serialization(post_params) # auth setting - self.update_params_for_auth(headers_params, query_params, auth_settings) + self.update_params_for_auth(header_params, query_params, auth_settings) # body if body: @@ -96,7 +97,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_params, + response_data = self.request(method, url, query_params=query_params, headers=header_params, post_params=post_params, body=body) # deserialize response data @@ -301,3 +302,4 @@ class ApiClient(object): raise ValueError('Authentication token must be in `query` or `header`') + diff --git a/samples/client/petstore/python/SwaggerPetstore-python/.coverage b/samples/client/petstore/python/SwaggerPetstore-python/.coverage deleted file mode 100644 index 50a2ec114f96392ad885009385cd17ebb246e395..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3297 zcmc(iX>e0z6ox&eh3+kT7g|bNXee!B3xa|OZp`TG!BV)Qz$J$CBMqcUZju%X6c7;v zSrt@7(Q(EF_ibF!(NSD+8%G`ShvN@*+(yS;T+jD4wbbeF^j9)>CO2=+ea`!Q*_hVl zkju*QM?xXxPefu)npNPBbf}mwpei~hyQjGuoIzGbC>U08C%wzba9JBYR$Rs6o`6y- zRcuYv6JO;E1XQf&wca0TQ2`b9#C>hikcxZ!p`Z#UJW-X1%Qq-bv@_8f347*uf2=8a zxxW9)o;JB#NN(aws6Zsv>5g_fgKcMs3&Su1MJT~IRH6zKPy-k0;6bCZ)~7b2FB*({ z+GQwSd8Y$r+D?`WBQZ(>7Gn&`Q6V9#CE|Q+z`Z!m8N}0wTS-}61CUi7MNiah+sWxK z>Uas;fXSGG(=ZLEV>)JFCeFev%*NR`2j^oBE(GIZG-00nEE`^24j=qz!Eyu;#0soL z2yF<%K@1(}#9FLFmkeMVuE7rM#BS`twYU!ZaXoIpjW~dta0?FMcHDuxa5oOisP4xT zcnVMB89a;U@H}3?i+Bk~@iJb)t9S#)@DAR?`}hDK;v;;F&+#R`#y9vLKj26Fj9>68 ze#7rLfxqxKr;(og5aLYYEaDvEJmM1KGUBns6~yC+tB9+KClJ>VPb97-o5noBXnRpBFR^n~M+lhA&?5lT>sGK`gdbzvfEF$wi> z<5VNJExx@X996CC(=kWp339nZ_%Y54@aDkAH3=CESRQV?dDzu%U{{<4rGE-ihNe@M0Eh?r* zG|YB}_eyAvveu<`^OAYAc66K(wllIfPLs0M4oDm^i%v7jc1HK6={9sV#v4oP&95`N z?~(1FB6gWBW|=K}FGFlkZR(hco4iG~Q|v+-1_|-q4VG`ZtGl_1<&;rsG_ECHn@ryz z&80g_CqK{F5Ykq2lSXV7CoV9pb(yr*Vl0v7(tcbfhE!t6R`FvSqQ;GJBus~CL#`J; zUV%;6jH|F!x@?y;*{=t6w+WA__ICHb;8cs) 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 deleted file mode 100644 index ade0b73120..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 94955251c3..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 8b13789179..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - 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 deleted file mode 100644 index cf46870af1..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index 58cccc9f2e..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt +++ /dev/null @@ -1,2 +0,0 @@ -tests -SwaggerPetstore diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/config.py b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/config.py index ec3dbe8efb..46e60ccf41 100644 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/config.py +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/config.py @@ -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 { diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/swagger.py b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/swagger.py index f01192dd46..d7b896d3c0 100644 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/swagger.py +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/swagger.py @@ -62,12 +62,12 @@ 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) + header_params = header_params or {} + header_params.update(self.default_headers) if self.cookie: - headers['Cookie'] = self.cookie - if headers: - headers = self.sanitize_for_serialization(headers) + header_params['Cookie'] = self.cookie + if header_params: + header_params = ApiClient.sanitize_for_serialization(header_params) # path parameters if path_params: @@ -87,7 +87,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(header_params, query_params, auth_settings) # body if body: @@ -97,7 +97,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=header_params, post_params=post_params, body=body) # deserialize response data @@ -302,3 +302,4 @@ class ApiClient(object): raise ValueError('Authentication token must be in `query` or `header`') + diff --git a/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log b/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log deleted file mode 100644 index 0549f97e65..0000000000 --- a/samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log +++ /dev/null @@ -1,5 +0,0 @@ -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...