wanted: ftp server class
exarkun at divmod.com
Tue Mar 7 03:23:00 CET 2006
On Mon, 06 Mar 2006 16:37:21 GMT, John Pote <johnpote at blueyonder.co.uk> wrote:
>I have a 'client' with a built in ftp client that I wish to use to access a
>server via the internet. But I do not want to use a standard disk accessing
>ftp server as I need to do my own processing between the filesystem and the
>ftp TCP/IP port.
>Can someone suggest the source of a Python ftp server class (ftplib only has
>a client class) out there. (These days I try to keep all my programming to
>I seem to remember reading Twisted has some ftp server facilities. Does it?
>Any comments on it - easy to use, steep learning curve?
If you're familiar with interfaces (and even if you're not, perhaps), you may find <http://twistedmatrix.com/trac/browser/trunk/twisted/protocols/ftp.py#L1185> informative. Twisted includes one-ish concrete implementations of this interface, <http://twistedmatrix.com/trac/browser/trunk/twisted/protocols/ftp.py#L1412> and <http://twistedmatrix.com/trac/browser/trunk/twisted/protocols/ftp.py#L1545>. The latter merely adds write access to the former's read-only nature.
Creating a custom server essentially means writing your own version of a class like this and dropping it into the right place. The learning curve can be pretty steep, but this particular task is probably somewhat easier than most, since you won't actually be touching the protocol layer directly, but instead working with a high-level abstraction set between you and it. The one bit which might trip you up is the producer/consumer part, which has been somewhat lacking in documentation: the sample implementation of these is pretty straightforward, though, so you might figure it out by looking at those; also, just yesterday a document was added covering these concepts (however, it is not yet on the website, so you will only be able to find the unprocessed version of it in the repository browser at <http://twistedmatrix.com/trac/browser/trunk/doc/core/howto/producers.xhtml>).
It might be beneficial to direct follow-up questions to the Twisted list (<http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python>), since more people familiar with this will be paying attention there.
More information about the Python-list