2
我正在嘗試設置FTP TLS傳輸。我有嚴格的FTP和SFTP腳本,但這是我第一次接觸到TLS。我的基本腳本:Python FTP TLS不工作
import ftplib
import ssl
ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1_2)
ftps = ftplib.FTP_TLS(context=ctx)
print (ftps.connect(myhost,21))
print(ftps.login(myusername,mypwd))
print("1")
ftps.prot_p()
print("2")
print (ftps.retrlines('LIST'))
print("3")
錯誤:
[WinError 10054] An existing connection was forcibly closed by the remote host
在retrlines線會出現此錯誤。它表示錯誤出現在do_handshake self._sslobj.do_handshake()
的ssl.py中。
我已經驗證了與WinSCP
的連接,並且協議是TLS1.2
。
任何想法?