'Bandwidth throttling using Paramiko

I’m using Paramiko and Python to upload files to my SFTP server. Is there a way to implement bandwidth throttling if my file is huge?

def upload_files(local, server):
   transport = paramiko.transport(host, port)
   transport.connect(user, password)
   sftp = Paramiko.SFTPClient.from transport(transport)
   sftp.put(local, server)


Solution 1:[1]

You can use callback argument of SFTPClient.put to implement the throttling.

Here is a sample code for download. For upload it will be pretty much the same:
Decrease Paramiko maximal request size

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Martin Prikryl