Closed TheSil closed 6 years ago
I was able to solve this by creating the FTPHandler classes dynamically (Python is truly marvelous...):
def create_ftp_handler():
class FTPHandlerMulti(FTPHandler):
pass
return FTPHandlerMulti
Then instead of handler = FTPHandler
one can just use handler = create_ftp_handler()
. Perhaps it has nicer solution using metaclasses, but this works...
I am running several instances of FTP Servers from single script, each on different ip address (basically just multiple ip aliases on single loopback adapter). However when using the FTPHandler class, I have noticed that it has class variables such as an authorizer. This causes issues when different settings are required for different servers (accounts, banner, etc..).
Is there a way to run multiple FTP server instances, each with their own account settings (and banners, etc...)? Only thing that I've come up with is to run separate scripts, but I thought it should be possible from API provided, maybe I am just missing something.