Added custom port support for ftp access

This commit is contained in:
TheDudeFromCI 2021-08-03 03:00:23 -07:00 committed by GitHub
parent 2e459cafe2
commit 0c3bace49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,9 +10,10 @@ from handlers.handle_config import configurationValues
def createFTPConnection(): def createFTPConnection():
configValues = configurationValues() configValues = configurationValues()
ftp = ftplib.FTP(configValues.sftp_server, user=configValues.sftp_user, \
passwd=configValues.sftp_password)
try: try:
ftp = ftplib.FTP()
ftp.connect(configValues.sftp_server, configValues.sftp_port)
ftp.login(configValues.sftp_user, configValues.sftp_password)
return ftp return ftp
except UnboundLocalError: except UnboundLocalError:
print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite) print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite)