Skip to content

Commit

Permalink
Updated readme, examples readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkittenis committed Aug 16, 2017
1 parent 25715d2 commit 3c78694
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Super fast SSH2 protocol library. ``ssh2-python`` provides Python bindings for `
:alt: Latest Version
.. image:: https://travis-ci.org/ParallelSSH/ssh2-python.svg?branch=master
:target: https://travis-ci.org/ParallelSSH/ssh2-python
.. image:: https://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python/branch/master?svg=true
.. image:: https://ci.appveyor.com/api/projects/status/github/parallelssh/ssh2-python?svg=true&branch=master
:target: https://ci.appveyor.com/project/pkittenis/ssh2-python

Installation
Expand Down
40 changes: 37 additions & 3 deletions examples/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,35 @@ Pkey from file
.. code-block:: shell
python examples/publickey_fromfile.py ~/.ssh/id_rsa 'echo me'
me
::

me

Non-blocking execute
----------------------

.. code-block:: shell
python examples/nonblocking_execute.py 'echo me'
::

Would block, waiting for socket to be ready
Would block, waiting for socket to be ready
Waiting for command to finish
Waiting for command to finish
me

SFTP write
-----------

.. code-block:: shell
python examples/sftp_write.py ~/<my source file> ~/<my dest file>
::

Starting copy of local file <source file> to remote localhost:<dest file>
Finished writing remote file in 0:00:00.006304

Expand All @@ -44,6 +51,9 @@ SFTP read
.. code-block:: shell
python examples/sftp_read.py ~/<remote file>
::

Starting read for remote file <remote file>
Finished file read in 0:00:00.045763

Expand All @@ -55,6 +65,9 @@ Note there is no error checking and file is assumed to exist. The script will ha
.. code-block:: shell
python examples/nonblocking_sftp_read.py <remote file>
::

Would block on sftp init, waiting for socket to be ready
<..>
Would block on sftp init, waiting for socket to be ready
Expand All @@ -63,6 +76,20 @@ Note there is no error checking and file is assumed to exist. The script will ha
Would block on read, waiting..
Finished file read in 0:00:00.056730

Non-blocking SFTP readdir
---------------------------

Print a directory listing in non-blocking mode.

.. code-block:: shell
python examples/nonblocking_sftp_readdir.py .
::

Starting read for remote dir .
Would block on readdir, waiting on socket..
b'<..>'

Password authentication
-------------------------
Expand All @@ -72,6 +99,9 @@ Authentication with wrong password raises ``AuthenticationError`` exception.
.. code-block:: shell
python examples/password_auth.py 'asdfadf' 'echo me'
::

Traceback (most recent call last):
File "examples/password_auth.py", line 45, in <module>
main()
Expand All @@ -81,11 +111,15 @@ Authentication with wrong password raises ``AuthenticationError`` exception.
raise AuthenticationError(
ssh2.exceptions.AuthenticationError: ('Error authenticating user %s with password', '<user>')

SSH Agent authentication
--------------------------

Simple SSH agent authentication. The method used here is a helper function, not part of the libssh2 API, to do all the individual steps needed to retrieve, check and attempt to authenticate with an available SSH agent, raising exceptions on errors.

.. code-block:: shell
python examples/agent_auth.py 'echo me'
::

me

0 comments on commit 3c78694

Please sign in to comment.