Skip to content

Commit b1ca1b5

Browse files
Cory Toddcorytodd
authored andcommitted
[python] - update python-petstore security
Run ./bin/security/python-petstore.sh to pick up basic auth fixes. Note that there have been other template changes in python but security/python-petstore.sh was not run so the sample is out of date. I have intentionally excluded the changes that are not related to the basic auth fix. Signed-off-by: Cory Todd <[email protected]>
1 parent 26e607c commit b1ca1b5

File tree

2 files changed

+7
-4
lines changed

2 files changed

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

samples/client/petstore-security-test/python/petstore_api/configuration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,12 @@ def get_basic_auth_token(self):
214214
215215
:return: The token for basic HTTP authentication.
216216
"""
217-
return urllib3.util.make_headers(
218-
basic_auth=self.username + ':' + self.password
219-
).get('authorization')
217+
token = ""
218+
if self.username or self.password:
219+
token = urllib3.util.make_headers(
220+
basic_auth=self.username + ':' + self.password
221+
).get('authorization')
222+
return token
220223

221224
def auth_settings(self):
222225
"""Gets Auth Settings dict for api client.

0 commit comments

Comments
 (0)