mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-08 00:20:59 +00:00
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@5 e7d03fd6-7b0d-0410-9947-9c21f3af8025
26 lines
696 B
Python
26 lines
696 B
Python
import ftplib
|
|
from UrlData import UrlData
|
|
|
|
class FtpUrlData(UrlData):
|
|
"""
|
|
Url link with ftp scheme.
|
|
"""
|
|
|
|
def checkConnection(self, config):
|
|
self.urlConnection = ftplib.FTP(self.urlTuple[1],
|
|
config["user"], config["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)
|
|
|
|
|