summaryrefslogtreecommitdiff
path: root/paramiko/sftp_client.py
diff options
context:
space:
mode:
authorOlle Lundberg <geek@nerd.sh>2014-08-14 12:13:34 +0200
committerOlle Lundberg <geek@nerd.sh>2014-08-14 13:57:22 +0200
commit72c6b5ce3a49ec3c9cd68127091549c3fc4914cb (patch)
treebe542da69edcc1522110481569a3d73ac2c834df /paramiko/sftp_client.py
parentf6e789298fd31914c257c7cb8cde0f7ba31793bc (diff)
downloadparamiko-72c6b5ce3a49ec3c9cd68127091549c3fc4914cb.tar.gz
Expose the ability to set window/packet for sftp.
Diffstat (limited to 'paramiko/sftp_client.py')
-rw-r--r--paramiko/sftp_client.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index 1caaf165..ac0071db 100644
--- a/paramiko/sftp_client.py
+++ b/paramiko/sftp_client.py
@@ -61,7 +61,7 @@ b_slash = b'/'
class SFTPClient(BaseSFTP):
"""
SFTP client object.
-
+
Used to open an SFTP session across an open SSH `.Transport` and perform
remote file operations.
"""
@@ -98,16 +98,27 @@ class SFTPClient(BaseSFTP):
raise SSHException('EOF during negotiation')
self._log(INFO, 'Opened sftp connection (server version %d)' % server_version)
- def from_transport(cls, t):
+ def from_transport(cls, t, window_size=None, max_packet_size=None):
"""
Create an SFTP client channel from an open `.Transport`.
+ Setting the window and packet sizes might affect the transfer speed.
+ The default settings in the `.Transport` class are the same as in
+ OpenSSH and should work adequately for both files transfers and
+ interactive sessions.
+
:param .Transport t: an open `.Transport` which is already authenticated
+ :param int window_size:
+ optional window size for the `.SFTPClient` session.
+ :param int max_packet_size:
+ optional max packet size for the `.SFTPClient` session..
+
:return:
a new `.SFTPClient` object, referring to an sftp session (channel)
across the transport
"""
- chan = t.open_session()
+ chan = t.open_session(window_size=window_size,
+ max_packet_size=max_packet_size)
if chan is None:
return None
chan.invoke_subsystem('sftp')
@@ -578,7 +589,7 @@ class SFTPClient(BaseSFTP):
.. versionadded:: 1.4
.. versionchanged:: 1.7.4
- ``callback`` and rich attribute return value added.
+ ``callback`` and rich attribute return value added.
.. versionchanged:: 1.7.7
``confirm`` param added.
"""