python-scp
Port variant py38
Summary Scp module for paramiko (PY38)
Package version 0.14.1
Homepage https://github.com/jbardin/scp.py
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py39
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 14 SEP 2021, 23:34:25 UTC
Port created 22 APR 2019, 15:05:04 UTC
Subpackage Descriptions
single Pure python scp module ====================== The scp.py module uses a paramiko transport to send and recieve 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
Configuration Switches (platform-specific settings discarded)
PY38 ON Build using Python 3.8 PY39 OFF Build using Python 3.9
Package Dependencies by Type
Build (only) python-pip:single:py38
autoselect-python:single:standard
Build and Runtime python38:single:standard
Runtime (only) python-paramiko:single:py38
Download groups
main mirror://PYPIWHL/24/e2/1ff5e51603bdca319ae0a0dc3ff3670531fca06a80d4c117b62e2d173859
Distribution File Information
e4e0b9b41b73ebcc4e988e8f43039dc3715e88f3ee7b3e2d21521975bcfc82ee 8358 scp-0.14.1-py2.py3-none-any.whl
Ports that require python-scp:py38
No other ports depend on this one.