[Twisted-Python] How do I upload files using FTPClient?

Andrew Bennetts andrew-twisted at puzzling.org
Mon Jan 6 18:37:22 EST 2003


On Mon, Jan 06, 2003 at 10:14:18AM -0800,  Daniel Burr wrote:
> 
> I've experimented with twisted.protocols.ftp.FTPClient, and the one thing I
> can't seem to grok is how to perform file uploads.  I've read through the
> code, and it seems that the FTP server class supports RETR and STOR, using
> DTPFactory, while FTPClient only supports RETR, and implements it
> independently.

Yes, that's my fault.  I haven't gotten around to that yet -- I might have a
stab at it tonight, it shouldn't actually be that hard.  I'll try to make sure
I get this done in time for the 1.0.2 release.

Let me know if there are any other FTP commands you want implemented -- I've
also got MDTM on my todo list, which should be trivial (in fact, the
apt-proxy guys have already implemented it! :).  The current range of
commands more-or-less reflects what I needed for a previous job, and not
much more, but I'm happy to add any that someone else finds useful.  STOR is
definitely useful (and probably the hardest -- the code for uploading from
the client isn't really there yet).

> Basically, I'm lost as to how to connect FTPClient to DTPFactory, such that I
> can send files from FTPClient.  I just need some pointers on how to accomplish
> this; it seems like the code is there to do it, but I'm missing the necessary
> Twisted mindset in this case.

DTPFactory is part of the FTP server, which currently shares no code with
the client.  The server is desperately in need of a rewrite/refactoring to
use twisted.web (so that you can have dynamic resources, and the like).
This is on my longer-term todo list...

-Andrew.





More information about the Twisted-Python mailing list