mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-03-24 09:50:23 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@24 e7d03fd6-7b0d-0410-9947-9c21f3af8025
26 lines
705 B
Python
26 lines
705 B
Python
import ftplib
|
|
from UrlData import UrlData
|
|
|
|
class FtpUrlData(UrlData):
|
|
"""
|
|
Url link with ftp scheme.
|
|
"""
|
|
|
|
def checkConnection(self, config):
|
|
_user, _password = self._getUserPassword(config)
|
|
self.urlConnection = ftplib.FTP(self.urlTuple[1], _user, _password)
|
|
info = self.urlConnection.getwelcome()
|
|
if not info:
|
|
self.closeConnection()
|
|
raise Exception, "Got no answer from FTP server"
|
|
self.setInfo(info)
|
|
|
|
def closeConnection(self):
|
|
try: self.urlConnection.quit()
|
|
except: pass
|
|
self.urlConnection = None
|
|
|
|
def __str__(self):
|
|
return "FTP link\n"+UrlData.__str__(self)
|
|
|
|
|