Minimal Parmaiko wrapper to make working with SSH easy.
Project description
sshed
===================
sshed is a minimal paramiko wrapper that makes working with ssh through python
just like working with it in normal SSH. It will use your configuration that
you have already created first then any extra options can be passed in through
the library that is using it. Servers are base objects that can be extended
to do other tasks. Also the API is dead simple.
Examples
-------------------
Creating a server from your ~/.ssh/config with ssh keys created. This also
uses a host alias.
```python
from sshed import servers
server = servers.from_conf('development')
server.run('whoami').output
>> ['cwood']
server.run('sudo whoami').output
>> ['root']
server.run('cd /var/www').returncode
>> 0
server.run('pwd').output
>> ['/var/www']
```
Creating a server from just a hostname
```python
from sshed import servers
server = servers.from_conf('myserver.com')
server.run('hostname').output
>> ['myserver.com']
```
Creating a new server without a ssh config
```python
from sshed.servers import Server
server = Server(username='username', hostname='development.mycompany.com',
password='supersecretpassword')
server.run( ... )
```
Working with argparse. This sshed module also has a helper for working
with argparse. You can import an action so that when a user puts in a
``--server server.mycompany.com`` it will create a new server instance
for that server.
Example:
```python
from sshed.argparse_actions import ServerAction
# some other argparse information
parser.add_argument('-s', '--server', action=ServerAction, dest='server')
```
===================
sshed is a minimal paramiko wrapper that makes working with ssh through python
just like working with it in normal SSH. It will use your configuration that
you have already created first then any extra options can be passed in through
the library that is using it. Servers are base objects that can be extended
to do other tasks. Also the API is dead simple.
Examples
-------------------
Creating a server from your ~/.ssh/config with ssh keys created. This also
uses a host alias.
```python
from sshed import servers
server = servers.from_conf('development')
server.run('whoami').output
>> ['cwood']
server.run('sudo whoami').output
>> ['root']
server.run('cd /var/www').returncode
>> 0
server.run('pwd').output
>> ['/var/www']
```
Creating a server from just a hostname
```python
from sshed import servers
server = servers.from_conf('myserver.com')
server.run('hostname').output
>> ['myserver.com']
```
Creating a new server without a ssh config
```python
from sshed.servers import Server
server = Server(username='username', hostname='development.mycompany.com',
password='supersecretpassword')
server.run( ... )
```
Working with argparse. This sshed module also has a helper for working
with argparse. You can import an action so that when a user puts in a
``--server server.mycompany.com`` it will create a new server instance
for that server.
Example:
```python
from sshed.argparse_actions import ServerAction
# some other argparse information
parser.add_argument('-s', '--server', action=ServerAction, dest='server')
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sshed-0.2.0.tar.gz
(3.4 kB
view details)
File details
Details for the file sshed-0.2.0.tar.gz
.
File metadata
- Download URL: sshed-0.2.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34df2bd1c27d65fb6104f1b8d8aa9482dafc86211093cee82b09882f8c71f4d3 |
|
MD5 | 31b9366d45856fb92630a6833eacd44e |
|
BLAKE2b-256 | ce4b6a667308e9392ee8be027b4265c0bd4062a0ed6435589976a724b0b8f10f |