FTPSHook气流(数据通道上需要522 SSL/TLS)

2024-03-28 13:58:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用FTPSHook通过ftptls/SSL显式加密发送文件。这是我的密码

remote_filepath=pathfile
local_filepath=pathfile2
hook = FTPSHook(ftp_conn_id='ftp_test')
hook.store_file(remote_filepath, local_filepath) 

当我运行DAG时,我得到了这个错误:

522 SSL/TLS required on the data channel

以前有人这样做过吗?如何保护与FTPSHook的连接


Tags: 文件testid密码sslremotelocalftp
1条回答
网友
1楼 · 发布于 2024-03-28 13:58:01

默认情况下,ftplib(用于FTPSHook的FTP的底层实现)不会加密FTP数据连接。要启用它,必须调用^{}。使用FTPSHookAPI,您可以这样做:

hook = FTPSHook(ftp_conn_id='ftp_test')
hook.get_conn().prot_p()

相关问题 更多 >