paramiko hangs on get after ownloading 20 MB of file

前端 未结 3 1235
孤独总比滥情好
孤独总比滥情好 2021-01-03 05:56

I am in need of python sftp client to download files from a sftp server. I started to use Paramiko. Small files in KB works well but however when I try to download 600 MB of

3条回答
  •  不知归路
    2021-01-03 06:20

    Increasing default_max_packet_size and default_window_size as follows worked for me:

    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.load_system_host_keys()
    
    client.connect(hostname, username=username, password=password, port=port)
    tr = client.get_transport()
    tr.default_max_packet_size = 100000000
    tr.default_window_size = 100000000
    sftp = client.open_sftp()
    sftp.get(remote_file, local_filepath)
    
    client.close()
    

提交回复
热议问题