Exceptions — Paramiko documentation

# Exceptions

exception `paramiko.ssh_exception.` `AuthenticationException`

  Exception raised when authentication failed for some reason. It may be possible to retry with different credentials. (Other classes specify more specific reasons.)

  New in version 1.6.

exception `paramiko.ssh_exception.` `BadAuthenticationType`(explanation, types)

  Exception raised when an authentication type (like password) is used, but the server isn’t allowing that type. (It may only allow public-key, for example.)

  Variables: | allowed_types (list) – list of allowed authentication types provided by the server (possible values are: `"none"`, `"password"`, and `"publickey"`).

  New in version 1.1.

exception `paramiko.ssh_exception.` `BadHostKeyException`(hostname, got_key, expected_key)

  The host key given by the SSH server did not match what we were expecting.

  Variables: | hostname (str) – the hostname of the SSH server got_key (PKey) – the host key presented by the server expected_key (PKey) – the host key expected

  New in version 1.6.

exception `paramiko.ssh_exception.` `ChannelException`(code, text)

  Exception raised when an attempt to open a new `Channel` fails.

  Variables: | code (int) – the error code returned by the server

  New in version 1.6.

exception `paramiko.ssh_exception.` `NoValidConnectionsError`(errors)

  Multiple connection attempts were made and no families succeeded.

  This exception class wraps multiple “real” underlying connection errors, all of which represent failed connection attempts. Because these errors are not guaranteed to all be of the same error type (i.e. different errno, `socket.error` subclass, message, etc) we expose a single unified error message and a `None` errno so that instances of this class match most normal handling of `socket.error` objects.

  To see the wrapped exception objects, access the `errors` attribute. `errors` is a dict whose keys are address tuples (e.g. `('127.0.0.1', 22)`) and whose values are the exception encountered trying to connect to that address.

  It is implied/assumed that all the errors given to a single instance of this class are from connecting to the same hostname + port (and thus that the differences are in the resolution of the hostname - e.g. IPv4 vs v6).

  `__init__`(errors)

    Parameters: | errors (dict) – The errors dict to store, as described by class docstring.

exception `paramiko.ssh_exception.` `PartialAuthentication`(types)

  An internal exception thrown in the case of partial authentication.

exception `paramiko.ssh_exception.` `PasswordRequiredException`

  Exception raised when a password is needed to unlock a private key file.

exception `paramiko.ssh_exception.` `ProxyCommandFailure`(command, error)

  The “ProxyCommand” found in the .ssh/config file returned an error.

  Variables: | command (str) – The command line that is generating this exception. error (str) – The error captured from the proxy command output.

exception `paramiko.ssh_exception.` `SSHException`

  Exception raised by failures in SSH2 protocol negotiation or logic errors.

  `__weakref__`

    list of weak references to the object (if defined)