Skip to main content

libssh C library bindings for Python.

Project description

Bindings for libssh C library.

License Latest Version https://circleci.com/gh/ParallelSSH/ssh-python/tree/master.svg?style=shield https://img.shields.io/pypi/wheel/ssh-python.svg https://img.shields.io/pypi/pyversions/ssh-python.svg https://ci.appveyor.com/api/projects/status/2t4bmmtjvfy5s1in/branch/master?svg=true Latest documentation

Installation

Binary wheels are provided for Linux (manylinux 2010), OSX (10.14 and 10.15 for brew Python), and Windows 64-bit (Python 3.6/3.7/3.8).

Wheels have no dependencies. For building from source, see documentation.

pip install ssh-python

Project is beta status, please report any issues.

Quick Start

from __future__ import print_function

import os
import pwd

from ssh.session import Session
from ssh import options

# Linux only
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:

me

Features

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

  • Thread safe - GIL released as much as possible

    • libssh threading limitations apply - anything not supported in C is not supported in Python

  • Very low overhead thin wrapper

  • Object oriented

    • Memory freed automatically and safely as objects are garbage collected by Python

  • Uses Python semantics where applicable

    • channel/file handle context manager support

    • channel/file handle iterator support

  • Raises low level C errors as Python exceptions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssh-python-0.7.0.post1.tar.gz (1.4 MB view hashes)

Uploaded Source

Built Distributions

ssh_python-0.7.0.post1-cp39-cp39-manylinux2010_x86_64.whl (6.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp38-cp38-win_amd64.whl (9.3 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

ssh_python-0.7.0.post1-cp38-cp38-manylinux2010_x86_64.whl (6.9 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp38-cp38-macosx_10_15_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

ssh_python-0.7.0.post1-cp37-cp37m-win_amd64.whl (9.3 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

ssh_python-0.7.0.post1-cp37-cp37m-manylinux2010_x86_64.whl (6.7 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp37-cp37m-macosx_10_14_x86_64.whl (2.3 MB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

ssh_python-0.7.0.post1-cp36-cp36m-win_amd64.whl (9.3 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

ssh_python-0.7.0.post1-cp36-cp36m-manylinux2010_x86_64.whl (6.7 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp35-cp35m-manylinux2010_x86_64.whl (6.6 MB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp27-cp27mu-manylinux2010_x86_64.whl (6.4 MB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

ssh_python-0.7.0.post1-cp27-cp27m-manylinux2010_x86_64.whl (6.4 MB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page