Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python bindings for libssh2 C library.

License

LGPL-2.1, LGPL-2.1 licenses found

Licenses found

LGPL-2.1
LICENSE
LGPL-2.1
COPYING
NotificationsYou must be signed in to change notification settings

ParallelSSH/ssh2-python

Super fast SSH2 protocol library.ssh2-python provides Python bindings forlibssh2.

LicenseLatest Versionhttps://circleci.com/gh/ParallelSSH/ssh2-python/tree/master.svg?style=svghttps://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python?svg=true&branch=masterLatest documentation

Installation

Binary wheel packages are provided for Linux, OSX and Windows, all Python versions. Wheel packages haveno dependencies.

pip may need to be updated to be able to install binary wheel packages -pip install -U pip.

pip install ssh2-python

For from source installation instructions, including building against system provided libssh2,see documentation.

Who Should Use This

Most developers will want to use thehigh level clientsinparallel-sshbased on this library.

pip install parallel-ssh
frompssh.clientsimportSSHClienthost='localhost'cmd='uname'client=SSHClient(host)host_out=client.run_command(cmd)forlineinhost_out.stdout:print(line)exit_code=host_out.exit_code

This library provides bindings to the low-level libssh2 C-API. It isnot high level, nor easy to use. Alot of codewould need to be written to use this library that is already provided by parallel-ssh.

Useparallel-ssh unlessreally sure using a C-API is what is wanted.

API Feature Set

At this time all of thelibssh2 API has been implemented up to the libssh2 version in the repository. Please report any missing implementation.

Complete example scripts for various operations can be found in theexamples directory.

In addition, asssh2-python is a thin wrapper oflibssh2 with Python semantics,its code examples can be ported straight over to Python with only minimal changes.

Examples

Seeexamples directory for complete examples.

Again, most developers will want to useparallel-ssh rather than thislibrary directly.

Comparison with other Python SSH libraries

Performance of above example, compared with Paramiko.

time python examples/example_echo.pytime python examples/paramiko_comparison.py
Output:

ssh2-python:

real       0m0.141suser       0m0.037ssys        0m0.008s

paramiko:

real       0m0.592suser       0m0.351ssys        0m0.021s

[8]ページ先頭

©2009-2025 Movatter.jp