Skip to content

Commit

Permalink
use basic auth when username or password are present
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMario committed Dec 1, 2023
1 parent 11b3213 commit e3cc21e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/resources/handlebars/python/configuration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,12 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):

:return: The token for basic HTTP authentication.
"""
return urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
token = ""
if self.username or self.password:
token = urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
return token

def auth_settings(self):
"""Gets Auth Settings dict for api client.
Expand Down

0 comments on commit e3cc21e

Please sign in to comment.