Validating Twisted FTPClient.retrieveFile Files for Completeness

I am writing a custom ftp client to work as a gatekeeper for incoming multimedia content from subcontractors hired by one of our partners. I chose twisted because it allows me to parse the contents of the file before writing files to disk locally, and I looked for cases to search for twisted files anyway. I use "twisted.protocols.ftp.FTPClient.retrieveFile" to get the file, pass the escape path to the file and the protocol to the "retrieveFile" method. I want to be absolutely sure that the entire file has been extracted, because the event handler in the callback will write the file to disk locally, and then delete the deleted file from the alla '-E' behavior of the ftp server in the lftp client. My question is: do I really need to worry about this, or can I assume that the error will return,if the file will not be fully restored?

+3
source share
1 answer

There are several unit tests for behavior in this area.

twisted.test.test_ftp.FTPClientTestCase.test_failedRETRis the most relevant. It covers the case where control and data connections are lost during file transfer.

, . , , , , . , , , FTP . . , , , . - , LIST (FTPClient.list).

, , , , , , , . Deferred, retrieveFile, , .

+4

Source: https://habr.com/ru/post/1723246/


All Articles