[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Libssh Python bindings
[Thread Prev] | [Thread Next]
- Subject: Libssh Python bindings
- From: Pan K <zuboci@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 28 Jun 2018 12:07:03 +0100
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
First off, thank you for the awesome library.
I wanted to let you know about new Python bindings that have written for libssh. Code is at https://github.com/ParallelSSH/ssh-python
It is beta status and currently lacks SCP and server implementations. Everything else is implemented though there may be bugs.
Only distributed as source code for now. Wheels - python binary packages that work across distributions - to follow.
pip install ssh-python
from __future__ import print_functionimport osimport pwdfrom ssh.session import Sessionfrom ssh import optionsUSERNAME = pwd.getpwuid(os.geteuid()).pw_nameHOST = 'localhost's = Session()s.options_set(options.HOST, HOST)s.connect()# Authenticate with agents.userauth_agent(USERNAME)chan = s.channel_new()chan.open_session()chan.request_exec('echo me')size, data = "">while size > 0:print(data.strip())size, data = "">chan.close()The project contains libssh source code as-is and builds an embedded libssh to use when it is installed. The embedded version is the latest master branch and only that version is supported.This is so it can keep track with latest features that are not yet released and also because supporting multiple versions with different functionality and header modifications is too time consuming for a single developer.These bindings may not be fully usable yet for my own use case which is concurrent, non-blocking, use of SSH via an event loop system library in parallel-ssh but useful none the less. The capabilities, stability and speed of libssh are sorely needed in the python library ecosystem.Have noticed that not all parts of libssh are fully usable in non-blocking mode, particularly connect and scp. Expect some patches where issues are found in future.Relatedly, there is a patch for ssh_connect timing out in non-blocking mode that was reported a while back on this list, an issue I have also run into. Be happy to rebase and test it if it can be considered for merging.Hope these bindings are useful to you as well.Regards,Panos
Archive administrator: email@example.com
Follow-Ups: Re: Libssh Python bindings Andreas Schneider <asn@xxxxxxxxxxxxxx>