I am trying to connect to connect to a FTP site to download some files:
from ftplib import FTP_TLS
from ftplib import FTP
import ssl
import ftplib
FTP_TLS.ssl_version = ssl.PROTOCOL_TLSv1_2
ftps = FTP_TLS(timeout=100)
ftps.set_debuglevel(2)
ftps.connect('IP', port)
ftps.auth()
ftps.prot_p()
ftps.login('username', 'password')
The program tries for sometime before it fails with the following error:
get '' Traceback (most recent call last): File "FTP.py", line 12, in ftps.connect('IP', port) File "C:_data\learn\Miniconda\lib\ftplib.py", line 155, in connect self.welcome = self.getresp() File "C:_data\learn\Miniconda\lib\ftplib.py", line 236, in getresp resp = self.getmultiline() File "C:_data\learn\Miniconda\lib\ftplib.py", line 222, in getmultiline line = self.getline() File "C:_data\learn\Miniconda\lib\ftplib.py", line 210, in getline raise EOFError EOFError
I am not sure what the cause of this error is . I can connect to the ftp server using the same details with a FTP client (FileZilla). Can anyone point out if there is issue with my code and possible options to fix this.
Edit 1
As suggested below posting FileZilla logs :
Status: Connecting to IP:Port... Status: Connection established, initializing TLS... Status: Verifying certificate... Status: TLS connection established, waiting for welcome message... Status: Logged in Status: Retrieving directory listing... Status: Directory listing of "/" successful
FIleZilla explicitly pops up a certificate which I press OK on my desktop after which the connection is established. I am assuming the failure here is because my code doesn't accept the certificate. Any help is appreciated.