# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-scp VERSION= 0.14.5 KEYWORDS= python VARIANTS= v11 v12 SDESC[v11]= Scp module for paramiko (3.11) SDESC[v12]= Scp module for paramiko (3.12) HOMEPAGE= https://github.com/jbardin/scp.py CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/7f/04/4bcc504e6c2fdcfee7d74a6d14a49db0f129baf2cfa19f61148f333e96b9 DISTFILE[1]= scp-0.14.5-py2.py3-none-any.whl:main DF_INDEX= 1 SPKGS[v11]= single SPKGS[v12]= single OPTIONS_AVAILABLE= PY311 PY312 OPTIONS_STANDARD= none VOPTS[v11]= PY311=ON PY312=OFF VOPTS[v12]= PY311=OFF PY312=ON DISTNAME= scp-0.14.5.dist-info GENERATED= yes [PY311].RUN_DEPENDS_ON= python-paramiko:single:v11 [PY311].USES_ON= python:v11,wheel [PY312].RUN_DEPENDS_ON= python-paramiko:single:v12 [PY312].USES_ON= python:v12,wheel [FILE:2494:descriptions/desc.single] Pure python scp module ====================== The scp.py module uses a paramiko transport to send and receive files via the scp1 protocol. This is the protocol as referenced from the openssh scp program, and has only been tested with this implementation. Example ------- .. code-block:: python from paramiko import SSHClient from scp import SCPClient ssh = SSHClient() ssh.load_system_host_keys() ssh.connect('example.com') # SCPCLient takes a paramiko transport as an argument scp = SCPClient(ssh.get_transport()) scp.put('test.txt', 'test2.txt') scp.get('test2.txt') # Uploading the 'test' directory with its content in the # '/home/user/dump' remote directory scp.put('test', recursive=True, remote_path='/home/user/dump') scp.close() .. code-block:: $ md5sum test.txt test2.txt fc264c65fb17b7db5237cf7ce1780769 test.txt fc264c65fb17b7db5237cf7ce1780769 test2.txt Using 'with' keyword -------------------- .. code-block:: python from paramiko import SSHClient from scp import SCPClient with SSHClient() as ssh: ssh.load_system_host_keys() ssh.connect('example.com') with SCPClient(ssh.get_transport()) as scp: scp.put('test.txt', 'test2.txt') scp.get('test2.txt') .. code-block:: $ md5sum test.txt test2.txt fc264c65fb17b7db5237cf7ce1780769 test.txt fc264c65fb17b7db5237cf7ce1780769 test2.txt Uploading file-like objects --------------------------- The putfo method can be used to upload file-like objects: .. code-block:: python import io from paramiko import SSHClient from scp import SCPClient ssh = SSHClient() ssh.load_system_host_keys() ssh.connect('example.com') # SCPCLient takes a paramiko transport as an argument scp = SCPClient(ssh.get_transport()) # generate in-memory file-like object fl = io.BytesIO() fl.write(b'test') fl.seek(0) # upload it directly from memory scp.putfo(fl, '/tmp/test.txt') # close connection scp.close() # close file handler fl.close() Tracking progress of your file uploads/downloads ------------------------------------------------ A progress function can be given as a callback to the SCPClient to handle how the current SCP operation handles the progress of the transfers. In the example below we print the percentage complete of the file transfer. .. code-block:: python from paramiko import SSHClient [FILE:110:distinfo] d224535dd8ed00294f52b0e0e18fde7a6fb7a3d06b97ede9e3f750fa7bf75c09 8653 scp-0.14.5-py2.py3-none-any.whl