[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Libssh Python bindings


My pleasure. Yes, had seen a couple but no updates for over six years as of now and parts of the API where never implemented.
 
The approach also differs - the ssh-python bindings are a thin wrapper, they do not change the libssh API in major ways beside adding object orientation and other python specific semantics for ease of use.
 


29.06.2018, 14:55, "Andreas Schneider" <asn@xxxxxxxxxxxxxx>:

On Thursday, 28 June 2018 13:07:03 CEST Pan K wrote:

 Hello list,

 First off, thank you for the awesome library.


Hi Panos,

thanks for the python bindings. I think there are several out there but none
is really maintained. I hope this will not be the case for yours.

I will look into the issues if I find some time. But currently I'm busy with
getting the patchsets in which are lurking around.


        Andreas

 I wanted to let you know about new Python bindings that have written for
 libssh. Code is athttps://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.
 To install:

 pip install ssh-python

 Quick example:

    from __future__ import print_function

    import os
    import pwd

    from ssh.session import Session
    from ssh import options

    USERNAME = pwd.getpwuid(os.geteuid()).pw_name
    HOST = 'localhost'

    s = Session()
    s.options_set(options.HOST, HOST)
    s.connect()

    # Authenticate with agent
    s.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



--
Andreas Schneider asn@xxxxxxxxxxxxxx
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D





Archive administrator: postmaster@lists.cynapses.org