@@ -139,14 +139,17 @@ def __init__(
139139 /impala/_thrift_api.py#L152-L160
140140 """
141141 if scheme in ("https" , "http" ) and thrift_transport is None :
142+ port = port or 1000
142143 ssl_context = None
143144 if scheme == "https" :
144145 ssl_context = create_default_context ()
145146 ssl_context .check_hostname = check_hostname == "true"
146147 ssl_cert = ssl_cert or "none"
147148 ssl_context .verify_mode = ssl_cert_parameter_map .get (ssl_cert , CERT_NONE )
148149 thrift_transport = thrift .transport .THttpClient .THttpClient (
149- uri_or_host = f"{ scheme } ://{ host } :{ port } /cliservice/" ,
150+ uri_or_host = "{scheme}://{host}:{port}/cliservice/" .format (
151+ scheme = scheme , host = host , port = port
152+ ),
150153 ssl_context = ssl_context ,
151154 )
152155
@@ -259,26 +262,40 @@ def sasl_factory():
259262 def _set_authorization_header (transport , username = None , password = None ):
260263 username = username or "user"
261264 password = password or "pass"
262- auth_credentials = f"{ username } :{ password } " .encode ("UTF-8" )
265+ auth_credentials = "{username}:{password}" .format (
266+ username = username , password = password
267+ ).encode ("UTF-8" )
263268 auth_credentials_base64 = base64 .standard_b64encode (auth_credentials ).decode (
264269 "UTF-8"
265270 )
266271 transport .setCustomHeaders (
267- {"Authorization" : f"Basic { auth_credentials_base64 } " }
272+ {
273+ "Authorization" : "Basic {auth_credentials_base64}" .format (
274+ auth_credentials_base64 = auth_credentials_base64
275+ )
276+ }
268277 )
269278
270279 @staticmethod
271- def _set_kerberos_header (transport , kerberos_service_name , host ) -> None :
280+ def _set_kerberos_header (transport , kerberos_service_name , host ):
272281 import kerberos
273282
274283 __ , krb_context = kerberos .authGSSClientInit (
275- service = f"{ kerberos_service_name } @{ host } "
284+ service = "{kerberos_service_name}@{host}" .format (
285+ kerberos_service_name = kerberos_service_name , host = host
286+ )
276287 )
277288 kerberos .authGSSClientClean (krb_context , "" )
278289 kerberos .authGSSClientStep (krb_context , "" )
279290 auth_header = kerberos .authGSSClientResponse (krb_context )
280291
281- transport .setCustomHeaders ({"Authorization" : f"Negotiate { auth_header } " })
292+ transport .setCustomHeaders (
293+ {
294+ "Authorization" : "Negotiate {auth_header}" .format (
295+ auth_header = auth_header
296+ )
297+ }
298+ )
282299
283300 def __enter__ (self ):
284301 """Transport should already be opened by __init__"""
0 commit comments