'getting 'Server connection dropped' error while downloading file > 50 MB from SFTP. pysftp and paramiko failed to load large file

try: cnopts = pysftp.CnOpts()

cnopts.hostkeys = None

print("connecting to %s as %s" % (host, username))

conn = pysftp.Connection( host=host,port=port,username=username,password=password,cnopts=cnopts
)
print("connection established successfully: ", conn)

except Exception as e:

print('failed to establish connection to targeted server=',end=" ")

print(e)

try:

conn.get('remote_file','local_file_path')

except Exception as e:

print(e)


Sources

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

Source: Stack Overflow

Solution Source