I'm trying to use FTPSHook to send file through FTP TLS/SSL Explicit Encryption. Here's my code
remote_filepath=pathfile
local_filepath=pathfile2
hook = FTPSHook(ftp_conn_id='ftp_test')
hook.store_file(remote_filepath, local_filepath)
and I'm getting this error when I run the DAG:
522 SSL/TLS required on the data channel
Does anyone ever done this before? How can I secure the connection with FTPSHook
?
The ftplib (the underlying implementation of FTP(S) for the FTPSHook
) does not encrypt the FTP data connection by default. To enable it, you have to call FTP_TLS.prot_p()
. With FTPSHook
API, you do it like this:
hook = FTPSHook(ftp_conn_id='ftp_test')
hook.get_conn().prot_p()