Instantly share code, notes, and snippets.

anonymous /gist:3006745
Created Jun 27, 2012

Embed
What would you like to do?
libssh2 session.startup and session.userauth_password sample code
sess=libssh2.Session()
sock.setblocking(0)
try:
code = sess.startup(sock)
if code == -37:
select([sock],[],[])
log.debug("trying...")
sess.startup(sock)
except Exception,e:
log.exception("\n\nException:",e)
sock.close()
raise
sess.userauth_password(username,password)
return sess
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment