summaryrefslogtreecommitdiff
path: root/paramiko/sftp_client.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2014-09-10 12:58:02 -0700
committerJeff Forcier <jeff@bitprophet.org>2014-09-10 12:58:02 -0700
commitbade24d2d5b76c3f38bf0310ea8072184ab95b2a (patch)
tree160c9e52fc9911696247c1fe9e4bfec3c15ab662 /paramiko/sftp_client.py
parent0063e64046c732e8c50fc5f54234942feaa313d9 (diff)
parente71f4e59878a636268475f642ed4e98a1b3e375d (diff)
downloadparamiko-bade24d2d5b76c3f38bf0310ea8072184ab95b2a.tar.gz
Merge branch 'master' into 216-int
Conflicts: paramiko/transport.py paramiko/util.py tests/test_client.py
Diffstat (limited to 'paramiko/sftp_client.py')
-rw-r--r--paramiko/sftp_client.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index 195d1ad5..62127cc2 100644
--- a/paramiko/sftp_client.py
+++ b/paramiko/sftp_client.py
@@ -62,7 +62,7 @@ b_slash = b'/'
class SFTPClient(BaseSFTP, ClosingContextManager):
"""
SFTP client object.
-
+
Used to open an SFTP session across an open SSH `.Transport` and perform
remote file operations.
@@ -101,16 +101,30 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
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
+
+ .. versionchanged:: 1.15
+ Added the ``window_size`` and ``max_packet_size`` arguments.
"""
- 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')
@@ -646,7 +660,7 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
.. 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.
"""