Skip to content

Commit 5dfd95e

Browse files
author
Cory Todd
committed
[python] - update python-petstore sample
Run ./bin/python-petstore.py to pick up basic auth fixes. Signed-off-by: Cory Todd <[email protected]>
1 parent e287f8b commit 5dfd95e

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.20-SNAPSHOT
1+
2.4.33-SNAPSHOT

samples/client/petstore/python/petstore_api/configuration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,12 @@ def get_basic_auth_token(self):
225225
226226
:return: The token for basic HTTP authentication.
227227
"""
228-
return urllib3.util.make_headers(
229-
basic_auth=self.username + ':' + self.password
230-
).get('authorization')
228+
token = ""
229+
if self.username or self.password:
230+
token = urllib3.util.make_headers(
231+
basic_auth=self.username + ':' + self.password
232+
).get('authorization')
233+
return token
231234

232235
def auth_settings(self):
233236
"""Gets Auth Settings dict for api client.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# coding: utf-8

0 commit comments

Comments
 (0)