From e3cc21ea20a61e4680c6f39dd68a41381a5e8095 Mon Sep 17 00:00:00 2001 From: Hugo Mercado Date: Fri, 1 Dec 2023 18:11:54 -0500 Subject: [PATCH] use basic auth when username or password are present --- .../resources/handlebars/python/configuration.mustache | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/resources/handlebars/python/configuration.mustache b/src/main/resources/handlebars/python/configuration.mustache index 803438be0f..adb6d9aa4b 100644 --- a/src/main/resources/handlebars/python/configuration.mustache +++ b/src/main/resources/handlebars/python/configuration.mustache @@ -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.