documentation in progress
[ncclient] / ncclient / transport / ssh.py
index 7b373d0..2a69c86 100644 (file)
@@ -25,27 +25,26 @@ from errors import AuthenticationError, SessionCloseError, SSHError, SSHUnknownH
 from session import Session
 
 import logging
-logger = logging.getLogger('ncclient.transport.ssh')
+logger = logging.getLogger("ncclient.transport.ssh")
 
 BUF_SIZE = 4096
 MSG_DELIM = "]]>]]>"
 TICK = 0.1
 
 def default_unknown_host_cb(host, fingerprint):
-    """An `unknown host callback` returns :const:`True` if it finds the key
-    acceptable, and :const:`False` if not.
+    """An `unknown host callback` returns :const:`True` if it finds the key acceptable, and
+    :const:`False` if not.
 
-    This default callback always returns :const:`False`, which would lead to
-    :meth:`connect` raising a :exc:`SSHUnknownHost` exception.
-
-    Supply another valid callback if you need to verify the host key
-    programatically.
+    This default callback always returns :const:`False`, which would lead to :meth:`connect` raising
+    a :exc:`SSHUnknownHost` exception.
+    
+    Supply another valid callback if you need to verify the host key programatically.
 
     :arg host: the hostname that needs to be verified
-    :type host: string
+    :type host: `string`
 
-    :arg fingerprint: a hex string representing the host key fingerprint
-    :type fingerprint: string
+    :arg fingerprint: a hex string representing the host key fingerprint, colon-delimited e.g. *4b:69:6c:72:6f:79:20:77:61:73:20:68:65:72:65:21*
+    :type fingerprint: `string`
     """
     return False
 
@@ -71,10 +70,11 @@ class SSHSession(Session):
         self._parsing_pos = 0
     
     def _parse(self):
-        '''Messages ae delimited by MSG_DELIM. The buffer could have grown by a
+        """Messages ae delimited by MSG_DELIM. The buffer could have grown by a
         maximum of BUF_SIZE bytes everytime this method is called. Retains state
         across method calls and if a byte has been read it will not be
-        considered again. '''
+        considered again.
+        """
         delim = MSG_DELIM
         n = len(delim) - 1
         expect = self._parsing_state
@@ -115,8 +115,7 @@ class SSHSession(Session):
         self._parsing_pos = self._buffer.tell()
 
     def load_known_hosts(self, filename=None):
-        """Load host keys from a :file:`known_hosts`-style file. Can be called multiple
-        times.
+        """Load host keys from a :file:`known_hosts`-style file. Can be called multiple times.
 
         If *filename* is not specified, looks in the default locations i.e.
         :file:`~/.ssh/known_hosts` and :file:`~/ssh/known_hosts` for Windows.
@@ -144,11 +143,11 @@ class SSHSession(Session):
                 unknown_host_cb=default_unknown_host_cb,
                 username=None, password=None,
                 key_filename=None, allow_agent=True, look_for_keys=True):
-        """Connect via SSH and initialize the NETCONF session. First attempts
-        the publickey authentication method and then password authentication.
+        """Connect via SSH and initialize the NETCONF session. First attempts the publickey
+        authentication method and then password authentication.
 
-        To disable attemting publickey authentication altogether, call with
-        *allow_agent* and *look_for_keys* as :const:`False`.
+        To disable attemting publickey authentication altogether, call with *allow_agent* and
+        *look_for_keys* as :const:`False`.
 
         :arg host: the hostname or IP address to connect to
         :type host: `string`
@@ -156,10 +155,10 @@ class SSHSession(Session):
         :arg port: by default 830, but some devices use the default SSH port of 22 so this may need to be specified
         :type port: `int`
 
-        :arg timeout: an optional timeout for the TCP handshake
+        :arg timeout: an optional timeout for socket connect
         :type timeout: `int`
 
-        :arg unknown_host_cb: called when a host key is not recognized
+        :arg unknown_host_cb: called when the server host key is not recognized
         :type unknown_host_cb: see :meth:`signature <ssh.default_unknown_host_cb>`
 
         :arg username: the username to use for SSH authentication