From eac884d85b7053379a451d99e2d0a9bfdb5db9d8 Mon Sep 17 00:00:00 2001 From: geekerzp Date: Wed, 27 May 2015 20:35:59 +0800 Subject: [PATCH] updated ApiClient of python sdk. --- .../src/main/resources/python/config.mustache | 3 +-- .../main/resources/python/swagger.mustache | 13 +++++---- .../python/SwaggerPetstore-python/.coverage | Bin 0 -> 3297 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 ++ .../dev-requirements.txt.log | 5 ++++ 9 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/.coverage create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/PKG-INFO create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/SOURCES.txt create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/dependency_links.txt create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/requires.txt create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore.egg-info/top_level.txt create mode 100644 samples/client/petstore/python/SwaggerPetstore-python/dev-requirements.txt.log 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 0000000000000000000000000000000000000000..50a2ec114f96392ad885009385cd17ebb246e395 GIT binary patch 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) literal 0 HcmV?d00001 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...