Ravenports generated: 03 Dec 2019 10:55
[ravenports.git] / bucket_42 / python-scp
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               python-scp
4 VERSION=                0.13.2
5 KEYWORDS=               python
6 VARIANTS=               py27 py38 py37
7 SDESC[py37]=            Scp module for paramiko (PY 37)
8 SDESC[py38]=            Scp module for paramiko (PY 38)
9 SDESC[py27]=            Scp module for paramiko (PY 27)
10 HOMEPAGE=               https://github.com/jbardin/scp.py
11 CONTACT=                Python_Automaton[python@ironwolf.systems]
12
13 DOWNLOAD_GROUPS=        main
14 SITES[main]=            PYPI/s/scp
15 DISTFILE[1]=            scp-0.13.2.tar.gz:main
16 DF_INDEX=               1
17 SPKGS[py37]=            single
18 SPKGS[py38]=            single
19 SPKGS[py27]=            single
20
21 OPTIONS_AVAILABLE=      PY27 PY38 PY37
22 OPTIONS_STANDARD=       none
23 VOPTS[py37]=            PY27=OFF PY38=OFF PY37=ON
24 VOPTS[py38]=            PY27=OFF PY38=ON PY37=OFF
25 VOPTS[py27]=            PY27=ON PY38=OFF PY37=OFF
26
27 DISTNAME=               scp-0.13.2
28
29 GENERATED=              yes
30
31 [PY37].BUILDRUN_DEPENDS_ON=             python-paramiko:single:py37
32 [PY37].USES_ON=                         python:py37
33
34 [PY38].BUILDRUN_DEPENDS_ON=             python-paramiko:single:py38
35 [PY38].USES_ON=                         python:py38
36
37 [PY27].BUILDRUN_DEPENDS_ON=             python-paramiko:single:py27
38 [PY27].USES_ON=                         python:py27
39
40 [FILE:2420:descriptions/desc.single]
41 Pure python scp module
42 ======================
43
44 The scp.py module uses a paramiko transport to send and recieve files via
45 the
46 scp1 protocol. This is the protocol as referenced from the openssh scp
47 program,
48 and has only been tested with this implementation.
49
50
51 Example
52 -------
53
54 ..  code-block:: python
55
56     from paramiko import SSHClient
57     from scp import SCPClient
58
59     ssh = SSHClient()
60     ssh.load_system_host_keys()
61     ssh.connect('example.com')
62
63     # SCPCLient takes a paramiko transport as an argument
64     scp = SCPClient(ssh.get_transport())
65
66     scp.put('test.txt', 'test2.txt')
67     scp.get('test2.txt')
68
69     # Uploading the 'test' directory with its content in the
70     # '/home/user/dump' remote directory
71     scp.put('test', recursive=True, remote_path='/home/user/dump')
72
73     scp.close()
74
75
76 ..  code-block::
77
78     $ md5sum test.txt test2.txt
79     fc264c65fb17b7db5237cf7ce1780769 test.txt
80     fc264c65fb17b7db5237cf7ce1780769 test2.txt
81
82 Using 'with' keyword
83 --------------------
84
85 ..  code-block:: python
86
87     from paramiko import SSHClient
88     from scp import SCPClient
89
90     ssh = SSHClient()
91     ssh.load_system_host_keys()
92     ssh.connect('example.com')
93
94     with SCPClient(ssh.get_transport()) as scp:
95         scp.put('test.txt', 'test2.txt')
96         scp.get('test2.txt')
97
98
99 ..  code-block::
100
101     $ md5sum test.txt test2.txt
102     fc264c65fb17b7db5237cf7ce1780769 test.txt
103     fc264c65fb17b7db5237cf7ce1780769 test2.txt
104
105
106 Uploading file-like objects
107 ---------------------------
108
109 The ``putfo`` method can be used to upload file-like objects:
110
111 ..  code-block:: python
112
113     import io
114     from paramiko import SSHClient
115     from scp import SCPClient
116
117     ssh = SSHClient()
118     ssh.load_system_host_keys()
119     ssh.connect('example.com')
120
121     # SCPCLient takes a paramiko transport as an argument
122     scp = SCPClient(ssh.get_transport())
123
124     # generate in-memory file-like object
125     fl = io.BytesIO()
126     fl.write(b'test')
127     fl.seek(0)
128     # upload it directly from memory
129     scp.putfo(fl, '/tmp/test.txt')
130     # close connection
131     scp.close()
132     # close file handler
133     fl.close()
134
135
136 Tracking progress of your file uploads/downloads
137 ------------------------------------------------
138
139 A ``progress`` function can be given as a callback to the SCPClient to
140 handle
141 how the current SCP operation handles the progress of the transfers. In the
142 example below we print the percentage complete of the file transfer.
143
144
145
146 [FILE:96:distinfo]
147 ef9d6e67c0331485d3db146bf9ee9baff8a48f3eb0e6c08276a8584b13bf34b3        11517 scp-0.13.2.tar.gz
148