I'm trying to use ftplib to get a file listing and download any new files since my last check. The code I'm trying to run so far is:
#!/usr/bin/env python
from ftplib import FTP
import sys
host = 'ftp.***.com'
user = '***'
passwd = '***'
try:
ftp = FTP(host)
ftp.login(user, passwd)
except:
print 'Error connecting to FTP server'
sys.exit()
try:
ftp.retrlines('LIST')
except:
print 'Error fetching file listing'
ftp.quit()
sys.exit()
ftp.quit()
Whenever I run this it times out when I try to retrieve the listing. Any ideas?