SFTP中的详细选项

时间:2015-01-22 19:53:29

标签: pysftp

我正在使用Pysftp sftp放置大量文件,并希望在运行时获得一些进度输出,以便我知道它是如何进行的。是否有一个冗长的选项(或等效的)我可以用它来获得那个输出?

感谢。

1 个答案:

答案 0 :(得分:0)

我可能在这里错误地导入了paramiko,因为我仍然相信它会在pysftp中,但是您应该得到jist。

import logging
import paramiko
import pysftp
paramiko.util.log_to_file('log_debug.txt', level = 'DEBUG')
# As far as I can see you can use DEBUG, INFO, WARNING or ERROR here but there's possibly more
with pysftp.Connection([whatever you're doing here normally]) as sftp:
    sftp.put([or whatever you're doing here instead])
with open('log_debug.txt') as logfile:
    log = logfile.read()
print (log)

很明显,您不必打印它,做您喜欢的事情...
我只是试图做类似的事情而已,我不是专家!

相关问题