use pyftpdlib to connect with FTP
#define host
host=''
#define username
username=''
#define password
password=''
#define port
port=21
#loading all lib from pyftpdlib
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
from pyftpdlib.authorizers import DummyAuthorizer
#connecting ftp
authorizer = DummyAuthorizer()
authorizer.add_user(username,password,"/", perm='elradfmwM')
handler = FTPHandler
handler.authorizer=authorizer
server = FTPServer((host,port),handler)
server.serve_forever()
following code Instantiate a dummy authorizer for managing 'virtual' users
authorizer = DummyAuthorizer()
following code for Defining a new user having full r/w permissions and a read-only
authorizer.add_user(username,password,"/", perm='elradfmwM')
following code will Instantiate FTP handler class
handler = FTPHandler
handler.authorizer = authorizer
start ftp server
server.serve_forever()