gpt4 book ai didi

pysftp - SFTP 中的详细选项

转载 作者:行者123 更新时间:2023-12-01 06:26:26 24 4
gpt4 key购买 nike

我正在使用 Pysftp 来 sftp 放置大量文件,并且希望在它运行时获得一些进度输出,以便我知道它是如何做的。我可以使用详细选项(或等效选项)来获取该输出吗?

谢谢。

最佳答案

我可能在这里错误地导入了 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)

显然你不必打印它,做你喜欢的...
我只是通过尝试做类似的事情才得到这个,我不是专家!

关于pysftp - SFTP 中的详细选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28097502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com