Skip to main content

scrapli_scp

Project description

Welcome to Scrapli SCP project!

This project is about to add smart SCP capability to Scrapli based connections. By smart, I mean various checks before and after the file copy to ensure the file copy is possible and successful.

These are the checks done by default:

  1. checksum

  2. existence of file at destination (also with hash)

  3. available space at destination

  4. scp enablement on device (and tries to turn it on if needed)

  5. restore configuration after transfer if it was changed

  6. check MD5 after transfer

Requirements

scrapli, scrapli-community, asyncssh, aiofiles

Installation

$ pip install scrapli-scp

Simple example

You can find it in test folder but the main part:

async with AsyncScrapli(**device) as conn:
    scp = AsyncSrapliSCP(conn)
    result = await scp.file_transfer("put", src=filename, dst=".", force_scp_config=True)
print(result)

Progress bar example

from rich.progress import Progress

with Progress(refresh_per_second=100) as progress:
    task = progress.add_task("Getting config...")

    def progress_handler(srcpath: bytes, dstpath: bytes, copied: int, total: int):  # arg signature is important!
        progress.update(task, completed=copied, total=total, description=dstpath.decode())

    async with AsyncScrapli(**device) as conn:
        scp: AsyncSCPFortiOS = AsyncSrapliSCP(conn)
        result = await scp.get_config(
            filename=filename,
            overwrite=True,
            force_scp_config=True,
            progress_handler=progress_handler
        )
print(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapli_scp-0.1.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapli_scp-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file scrapli_scp-0.1.0.tar.gz.

File metadata

  • Download URL: scrapli_scp-0.1.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scrapli_scp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d8e08b5990e941d6f3bc8de6530ab71186136a3ccebac6e60adf4b8306242f2c
MD5 998c20b4006cb9f40a42e7e48cb3ee22
BLAKE2b-256 85b7234b7e32c802ad7c9d385dbe942eaac54a4ca5e43e5ec0bde550cede46fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapli_scp-0.1.0.tar.gz:

Publisher: publish-pypi.yml on realvitya/scrapli_scp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrapli_scp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scrapli_scp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for scrapli_scp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9de4a64219096b914af2fafc55ed44933e355d4ee44961c1a9bcedec3ca3fa92
MD5 299744c37a3791b4cc34816eb3c0062b
BLAKE2b-256 daaca57616e1038d96aed91fbaf7f4fbcfef02946682f132259e7f6d38fe661f

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapli_scp-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on realvitya/scrapli_scp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page