Metadata-Version: 2.1
Name: ssh-python
Version: 0.3.0rc1
Summary: Wrapper for libssh C library.
Home-page: https://github.com/ParallelSSH/ssh-python
Author: Panos Kittenis
Author-email: 22e889d8@opayq.com
License: LGPLv2
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: C
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: System :: Shells
Classifier: Topic :: System :: Networking
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: POSIX :: BSD
Classifier: Operating System :: MacOS :: MacOS X

ssh-python
============

Bindings for libssh_ C library.

.. image:: https://img.shields.io/badge/License-LGPL%20v2-blue.svg
   :target: https://pypi.python.org/pypi/ssh-python
   :alt: License
.. image:: https://img.shields.io/pypi/v/ssh-python.svg
   :target: https://pypi.python.org/pypi/ssh-python
   :alt: Latest Version

Installation
_____________

Currently only installation from source is provided. Binary wheels to follow.

To install from source, run the following:

.. code-block:: shell

   pip install ssh-python


Project is beta status.


Prerequisites
--------------

* OpenSSL *or* gcrypt library and development headers
* Optionally Zlib library and development headers for compression

``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.


Quick Start
_____________


.. code-block:: python

   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 = chan.read()
   while size > 0:
       print(data.strip())
       size, data = chan.read()
   chan.close()

Output:

.. code-block:: shell

  me


Features
_________

The library uses `Cython`_ based native code extensions as wrappers to ``libssh``.

* Thread safe - GIL is released as much as possible
* Very low overhead thin wrapper
* Object oriented - memory freed automatically and safely as objects are garbage collected by Python
* Use Python semantics where applicable, such as context manager and iterator support for opening and reading from channels and SFTP file handles
* Raise errors as Python exceptions


.. _libssh: https://www.libssh.org
.. _Cython: https://www.cython.org


