Utility Functions¶
-
ssh2.utils.
handle_error_codes
(int errcode) → int¶ Raise appropriate exception for given error code.
Returns 0 on no error and
LIBSSH2_ERROR_EAGAIN
onEAGAIN
.- Raises
Appropriate exception from
ssh2.exceptions
.- Parameters
errcode – Error code as returned by
ssh2.session.Session.last_errno()
-
ssh2.utils.
ssh2_exit
()¶ Call libssh2_exit
-
ssh2.utils.
version
(int required_version=0)¶ Get libssh2 version string.
Passing in a non-zero required_version causes the function to return None if version is less than required_version
- Parameters
required_version (int) – Minimum required version
-
ssh2.utils.
wait_socket
(_socket, Session session, timeout=1)¶ Helper function for testing non-blocking mode.
This function blocks the calling thread for <timeout> seconds - to be used only for testing purposes.