Skip to content

Commit e3cc21e

Browse files
committed
use basic auth when username or password are present
1 parent 11b3213 commit e3cc21e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/resources/handlebars/python/configuration.mustache

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,12 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
215215

216216
:return: The token for basic HTTP authentication.
217217
"""
218-
return urllib3.util.make_headers(
219-
basic_auth=self.username + ':' + self.password
220-
).get('authorization')
218+
token = ""
219+
if self.username or self.password:
220+
token = urllib3.util.make_headers(
221+
basic_auth=self.username + ':' + self.password
222+
).get('authorization')
223+
return token
221224

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

0 commit comments

Comments
 (0)