...
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None # disable host key checking.
# Connection to external SFTP server
with pysftp.Connection(host=SFTP_HOST,
port=SFTP_PORT,
username=SFTP_USER,
password=fernet_decrypt(fernet_key=SFTP_KEY, encoded=SFTP_PASS_ENC),
cnopts=cnopts,
) as sftp:
# Change external directory
with sftp.cd(EXTERNAL_DIR):
external_dir = sftp.listdir()
...