# HG changeset patch # User Jeff Forcier <jeff@bitprophet.org> # Date 1667598346 14400 # Fri Nov 04 17:45:46 2022 -0400 # Node ID 4284ca01462aa7c434b5b4abd0eeb1cbd2d91ef0 # Parent 83057e0532f44a493ca755a9151c974850633563 Docstring tweaks, changelog entry, re #2125 diff --git a/paramiko/client.py b/paramiko/client.py --- a/paramiko/client.py +++ b/paramiko/client.py @@ -315,8 +315,10 @@ :param dict disabled_algorithms: an optional dict passed directly to `.Transport` and its keyword argument of the same name. - :param transport_factory: an optional callable that takes in a new `socket` - `gss_kex`, `gss_deleg_creds`, `disabled_algorithms` and generates a + :param transport_factory: + an optional callable which is handed a subset of the constructor + arguments (primarily those related to the socket, GSS + functionality, and algorithm selection) and generates a `.Transport` instance to be used by this client. Defaults to `.Transport.__init__`. @@ -338,6 +340,8 @@ Added the ``passphrase`` argument. .. versionchanged:: 2.6 Added the ``disabled_algorithms`` argument. + .. versionchanged:: 2.12 + Added the ``transport_factory`` argument. """ if not sock: errors = {} diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,10 @@ Changelog ========= +- :feature:`2125` (also re: :issue:`2054`) Add a ``transport_factory`` kwarg to + `SSHClient.connect <paramiko.client.SSHClient.connect>` for advanced + users to gain more control over early Transport setup and manipulation. + Thanks to Noah Pederson for the patch. - :bug:`1822` (via, and relating to, far too many other issues to mention here) Update `~paramiko.client.SSHClient` so it explicitly closes its wrapped socket object upon encountering socket errors at connection time. This should