为了使用 ftputil lib 上可用的进度指示器,我如何传递块长度?
实际代码:import ftputil
class FileTransferUtils(object):
def __init__(self, address, user, password, remote_path, port):
self.host = address.split(':')[0]
self.start = ftputil.FTPHost(self.host, user, password, port=port, session_factory=OpenFTPSession)
self.start.chdir(remote_path)
self.remote_path = remote_path
def upload(self, filename):
try:
# how to pass the chunk size?
self.start.upload(filename, filename, callback=None)
return True
except Exception:
print('Upload failed')
raise
finally:
self.start.close()
提前致谢。