Commit e2786667 authored by Sergio Bruni's avatar Sergio Bruni

Last Commit

parent b9ba966a
......@@ -50,26 +50,26 @@ class FTP_GENERIC:
if self.ftp:
if self.is_connected(): return True
self.ftp = None
retry_counter = 0
while retry_counter < 3:
time.sleep((retry_counter + 1) * 10)
try:
o = urlparse(self.org)
if o.scheme == "ftp":
self.ftp = FTP(o.hostname, self.params, self.user, self.password)
elif o.scheme == "ftps":
self.ftp = ImplicitFTP_TLS(o.hostname, self.params, self.user, self.password)
else:
self.logger.error("[%s] Protocol [%s] is not managed from class [%s]" % (__name__, o.scheme, self.__class__))
return False
return True
except Exception as e:
retry_counter += 1
self.logger.error(
"[%s] connection failed! attempt number: [%d] Error: [%s]" % (__name__, retry_counter, str(e)))
self.logger.error(
"[%s] connection definitively failed! made [%d] attempts" % (__name__, retry_counter))
return False
retry_counter = 0
while retry_counter < 3:
time.sleep((retry_counter + 1) * 10)
try:
o = urlparse(self.org)
if o.scheme == "ftp":
self.ftp = FTP(o.hostname, self.params, self.user, self.password)
elif o.scheme == "ftps":
self.ftp = ImplicitFTP_TLS(o.hostname, self.params, self.user, self.password)
else:
self.logger.error("[%s] Protocol [%s] is not managed from class [%s]" % (__name__, o.scheme, self.__class__))
return False
return True
except Exception as e:
retry_counter += 1
self.logger.error(
"[%s] connection failed! attempt number: [%d] Error: [%s]" % (__name__, retry_counter, str(e)))
self.logger.error(
"[%s] connection definitively failed! made [%d] attempts" % (__name__, retry_counter))
return False
def reconnect(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment