diff --git a/pysqa/ext/remote.py b/pysqa/ext/remote.py index 3689ea4..19e5b73 100644 --- a/pysqa/ext/remote.py +++ b/pysqa/ext/remote.py @@ -235,11 +235,18 @@ def _open_ssh_connection(self): username=self._ssh_username, password=self._ssh_password, ) - elif self._ssh_password is not None and self._ssh_authenticator_service is not None: + elif ( + self._ssh_password is not None + and self._ssh_authenticator_service is not None + ): + def authentication(title, instructions, prompt_list): from pyauthenticator import get_two_factor_code + if len(prompt_list) > 0: - return [get_two_factor_code(service=self._ssh_authenticator_service)] + return [ + get_two_factor_code(service=self._ssh_authenticator_service) + ] else: return [] @@ -251,9 +258,7 @@ def authentication(title, instructions, prompt_list): ) ssh._transport.auth_interactive( - username=self._ssh_username, - handler=authentication, - submethods='' + username=self._ssh_username, handler=authentication, submethods="" ) else: raise ValueError("Un-supported authentication method.")