11Getting Started
22===============
33
4- While in many ways, sftpretty is just a thin wrapper over paramiko's SFTPClient,
5- there are a number of ways that we make it more productive and easier to
6- accomplish common, higher-level tasks. The following snippets show where we
7- add value to this great module. See the :doc: `sftpretty ` docs for a complete
8- listing.
4+ While in many ways, sftpretty is just a thin wrapper around paramiko's
5+ SFTPClient, there are a number of ways that we make it more productive
6+ to accomplish common, higher-level tasks. The following snippets show
7+ where we add value to this great module. See the :doc: `sftpretty ` docs
8+ for a complete listing.
99
1010
1111:meth: `sftpretty.Connection `
1212----------------------------
1313The Connection object is the base of sftpretty. It supports connections via
14- username and password.
14+ username and password or private key .
1515
1616.. code-block :: python
1717
@@ -65,21 +65,25 @@ How about a ``paramiko.AgentKey``? No problem, just set the private_key equal to
6565
6666 import sftpretty
6767
68- with sftpretty.Connection(' hostname' , username = ' me' , private_key = my_agentkey) as sftp:
68+ cnopts = sftpretty.CnOpts()
69+ keys = cnopts.get_agentkey()
70+
71+ with sftpretty.Connection(' hostname' , username = ' me' , private_key = keys[1 ]) as sftp:
6972 #
7073 # ... do sftp operations
7174 #
7275
73- The connection object allows the use of an IP address for the ``host `` and the
74- ability to optionally set the ``port ``, which defaults to 22, otherwise.
76+ The connection object allows the use of a hostname, IP address, or alias for
77+ the ``host `` and the ability to optionally set the ``port ``, which defaults
78+ to 22, otherwise.
7579
7680
7781:meth: `sftpretty.CnOpts `
7882------------------------
79- You can specify additional connection options using the sftpretty.CnOpts
80- object. These options are advanced and not applicable to most uses, because of
81- this they have been segmented from the Connection parameter list and made
82- available via the CnOpts obj/parameter .
83+ Additional connection options can be configured using the sftpretty.CnOpts
84+ object. These are advanced options and are not applicable to most use cases.
85+ Due to this they have been segmented from the Connection object parameter list
86+ and made available via a modular object .
8387
8488OpenSSH-style config objects are supported. The user's default home location
8589``~/.ssh/config `` is always checked though not required unless an alternative
@@ -96,7 +100,7 @@ private key or password authentication.
96100
97101 Config options always take precedence over parameters if both exist. Keep in
98102mind there will more than likely be a delta between the security option
99- algorithms your verion of SSH supports and those supported by our underlying
103+ algorithms your verion of SSH supports and those supported by the underlying
100104paramiko dependency.
101105
102106AVAILABLE OPENSSH CONFIG OPTIONS:
@@ -327,7 +331,7 @@ want to return to later.
327331:meth: `sftpretty.Connection.chmod `
328332----------------------------------
329333:meth: `.chmod ` is a wrapper around paramiko's except for the fact it will
330- takes an integer representation of the octal mode. No leading 0 or 0o
334+ take an integer representation of the octal mode. No leading 0 or 0o
331335wanted. We know it's suppose to be an octal, but who really remembers that?
332336
333337This way it is just like a command line ``chmod 644 readme.txt ``
@@ -348,15 +352,16 @@ This way it is just like a command line ``chmod 644 readme.txt``
348352
349353:meth: `sftpretty.Connection.chown `
350354----------------------------------
351- Allows you to specify just, gid, uid or both. If either gid or uid is None
352- *default *, then sftpretty does a stat to get the current ids and uses that to
353- fill in the missing parameter because the underlying paramiko method requires
354- that you explicitly set both.
355+ Allows you to specify just, gid, uid or both as integers . If either gid or uid
356+ is None *default *, then sftpretty does a stat to get the current ids and uses
357+ that to fill in the missing parameter because the underlying paramiko method
358+ requiers that you explicitly set both.
355359
356- **NOTE ** uid and gid are integers and relative to each system. Just because you
357- are uid 102 on your local system, a uid of 102 on the remote system most likely
358- won't be your login. You will need to do some homework to make sure that you
359- are setting these values as you intended.
360+ .. WARNING ::
361+ uid and gid are relative to each system. A uid of 102 on your local system,
362+ is no assurance of a remote system's user uid even when the usernames
363+ match. You will need to do some homework to make sure that you are setting
364+ these values as you intended.
360365
361366
362367:attr: `sftpretty.Connection.pwd `
@@ -418,7 +423,7 @@ number to use. Just like the unix cmd, `chmod` you use 744 not 0744 or 0o744.
418423-------------------------------------
419424A common scenario where you need to create all directories in a path as
420425needed, setting their mode, if created. Mode argument works just like
421- :meth: `.chmod `, that is an integer representation of the mode you want.
426+ :meth: `.chmod `, that is an integer representation of the octal mode you want.
422427
423428.. code-block :: python
424429
0 commit comments