You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently only installation from source is provided. Binary wheels to follow.
11
+
12
+
To install from source, run the following after cloning the repository
13
+
14
+
.. code-block:: shell
15
+
16
+
python setup.py install
17
+
18
+
19
+
Prerequisites
20
+
--------------
21
+
22
+
* OpenSSL library and development headers
23
+
* Optionally Zlib library and development headers for compression
24
+
25
+
``Libssh`` source code is embedded in this project and will be built when installation is triggered per above instructions. Versions of ``libssh`` other than the one embedded in this project are not supported.
26
+
27
+
28
+
Quick Start
29
+
_____________
30
+
31
+
32
+
.. code-block:: python
33
+
34
+
from__future__import print_function
35
+
36
+
import os
37
+
import pwd
38
+
39
+
from ssh.session import Session
40
+
from ssh import options
41
+
42
+
USERNAME= pwd.getpwuid(os.geteuid()).pw_name
43
+
HOST='localhost'
44
+
45
+
s = Session()
46
+
s.options_set(options.HOST, HOST)
47
+
s.connect()
48
+
49
+
# Authenticate with agent
50
+
s.userauth_agent(USERNAME)
51
+
52
+
chan = s.channel_new()
53
+
chan.open_session()
54
+
chan.request_exec('echo me')
55
+
size, data = chan.read()
56
+
while size >0:
57
+
print(data.strip())
58
+
size, data = chan.read()
59
+
chan.close()
60
+
61
+
Output:
62
+
63
+
.. code-block:: shell
64
+
65
+
me
66
+
67
+
68
+
Features
69
+
_________
70
+
71
+
The library uses `Cython`_ based native code extensions as wrappers to ``libssh``.
72
+
73
+
* Thread safe - GIL is released as much as possible
74
+
* Very low overhead
75
+
* Super fast as a consequence of the excellent C library it uses and prodigious use of native code
76
+
* Object oriented - memory freed automatically and safely as objects are garbage collected by Python
77
+
* Use Python semantics where applicable, such as context manager and iterator support for opening and reading from channels and SFTP file handles
0 commit comments