@@ -95,13 +95,14 @@ def __init__(self,
9595 self .host = server_hostname
9696 self .port = kwargs .get ("_port" , 443 )
9797
98+ authorization_header = []
9899 if kwargs .get ("_username" ) and kwargs .get ("_password" ):
99100 auth_credentials = "{username}:{password}" .format (
100101 username = kwargs .get ("_username" ), password = kwargs .get ("_password" )).encode ("UTF-8" )
101102 auth_credentials_base64 = base64 .standard_b64encode (auth_credentials ).decode ("UTF-8" )
102- authorization_header = " Basic {}" .format (auth_credentials_base64 )
103+ authorization_header = [( "Authorization" , " Basic {}" .format (auth_credentials_base64 ))]
103104 elif access_token :
104- authorization_header = " Bearer {}" .format (access_token )
105+ authorization_header = [( "Authorization" , " Bearer {}" .format (access_token ))]
105106 elif not (kwargs .get ("_use_cert_as_auth" ) and kwargs .get ("_tls_client_cert_file" )):
106107 raise ValueError ("No valid authentication settings. Please provide an access token." )
107108
@@ -111,9 +112,8 @@ def __init__(self,
111112 useragent_header = "{}/{} ({})" .format (USER_AGENT_NAME , __version__ ,
112113 kwargs .get ("_user_agent_entry" ))
113114
114- base_headers = [("Authorization" , authorization_header ),
115- ("X-Databricks-Sqlgateway-CommandService-Mode" , "grpc-thrift" ),
116- ("User-Agent" , useragent_header )]
115+ base_headers = [("X-Databricks-Sqlgateway-CommandService-Mode" , "grpc-thrift" ),
116+ ("User-Agent" , useragent_header )] + authorization_header
117117
118118 if not kwargs .get ("_skip_routing_headers" ):
119119 base_headers .append (self ._http_path_to_routing_header (http_path ))
0 commit comments