Registry / http-networking / scrapli

scrapli

JSON →
library2026.2.20pypiunverified

Scrapli (scrape cli) is a fast, flexible, Python 3.9+ library designed for connecting to and interacting with network devices (routers, switches, firewalls) via SSH or Telnet. It supports both synchronous and asynchronous operations, offering a consistent API across different connection types. The library is actively developed, with frequent releases including release candidates for a major v2.0.0 update, indicating ongoing enhancements and maintenance.

pip install scrapli
INSTALL
IMPORT
SIG · SCRAPLI
S
scrapli
http-networkingenv2026.2.20
Install
20.4s avg
Import
412ms
Disk
350MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2026.2.20 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
2/4 runs
✓ 23.5s
py 3.11
2/4 runs
✓ 22.7s
py 3.12
✓ —
✓ 22.23s
py 3.13
✓ —
✓ 2.58s
py 3.9
2/4 runs
✓ 31.1s
350MB installed
● package 350MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Scrapli
from scrapli import Scrapli
General factory class for platform-agnostic connections
IOSXEDriver
from scrapli.driver.core import IOSXEDriver
Specific synchronous driver for Cisco IOS-XE devices. Replace 'IOSXEDriver' with the appropriate driver for your platform (e.g., 'NXOSDriver', 'JunosDriver', 'EOSDriver', 'IOSXRDriver').
AsyncIOSXEDriver
from scrapli.driver.core import AsyncIOSXEDriver
Specific asynchronous driver for Cisco IOS-XE devices. Replace 'AsyncIOSXEDriver' with the appropriate driver for your platform.
NetconfDriver
from scrapli_netconf.driver import NetconfDriver
from scrapli_netconf import NetconfScrape
The 'NetconfScrape' class was deprecated and removed in 'scrapli_netconf' v2022.01.30. Use 'NetconfDriver' instead for NETCONF connections.

This quickstart demonstrates a synchronous connection to a Cisco IOS-XE device, sending a 'show version' command and a configuration. It uses the `IOSXEDriver` with a context manager for automatic connection management. Device credentials are retrieved from environment variables for security. Replace `IOSXEDriver` with `AsyncIOSXEDriver` and `conn.send_command` with `await conn.send_command` within an `async def` function if using asynchronous operations.

import os from scrapli.driver.core import IOSXEDriver from scrapli.exceptions import ScrapliException def get_device_info(): device = { "host": os.environ.get("SCRAPLI_HOST", "your_device_ip"), "auth_username": os.environ.get("SCRAPLI_USERNAME", "admin"), "auth_password": os.environ.get("SCRAPLI_PASSWORD", "password"), "auth_strict_key": False, # Often needed for labs or unknown hosts "transport": "system", # 'system', 'paramiko', 'ssh2', 'telnet' "port": 22 # Default for SSH, 23 for Telnet } return device def main_sync(): device_info = get_device_info() try: # Using a context manager for automatic open/close with IOSXEDriver(**device_info) as conn: print(f"Connected to {conn.host} successfully.") response = conn.send_command("show version") if response.failed: print(f"Command failed: {response.result}") return print("--- Show Version Output ---") print(response.result) response_config = conn.send_configs(["interface Loopback0", "description Test Loopback"]) if response_config.failed: print(f"Config failed: {response_config.result}") return print("--- Configuration Output ---") print(response_config.result) except ScrapliException as e: print(f"Scrapli error: {e}") except Exception as e: print(f"An unexpected error occurred: {e}") if __name__ == "__main__": # Example usage: Set environment variables or update `get_device_info` with actual values # os.environ['SCRAPLI_HOST'] = '172.18.0.11' # os.environ['SCRAPLI_USERNAME'] = 'vrnetlab' # os.environ['SCRAPLI_PASSWORD'] = 'VR-netlab9' main_sync()
Debug
Known issues
breakingScrapli v2.0.0, currently in Release Candidate, introduces significant architectural changes ('scrapli2'). While the core API aims for consistency between sync/async, users should review the changelog for specific breaking changes in import paths, class structures, or method signatures upon the final v2.0.0 release.
fix
Consult the official v2.0.0 documentation and migration guides upon final release. For now, pin to `scrapli<2.0.0` for stability.
affects: >=2.0.0-rc.1
deprecatedSupport for Python 3.6 was dropped in scrapli core (v2022.01.30) and related libraries like `scrapli_netconf` and `scrapli_community`.
fix
Upgrade your Python environment to 3.9 or higher. The current version requires Python >=3.9.
affects: >=2022.01.30
deprecatedIn `scrapli_netconf`, `NetconfScrape` and `AsyncNetconfScrape` classes were renamed to `NetconfDriver` and `AsyncNetconfDriver`, respectively, and subsequently removed.
fix
Update your imports from `from scrapli_netconf import NetconfScrape` to `from scrapli_netconf.driver import NetconfDriver`.
affects: scrapli_netconf >=2022.01.30
gotchaBy default, scrapli uses 'system' transport, leveraging the local SSH binary. While this has zero external Python dependencies, it may require `auth_strict_key=False` in device arguments to bypass strict host key checking, especially in lab environments or when `known_hosts` is not managed.
fix
Include `auth_strict_key=False` in your device dictionary if you encounter host key verification issues. For production, consider proper `known_hosts` management or specifying an SSH config file.
affects: All
gotchaScrapli's core library supports a limited set of 'NAPALM-like' platforms (Cisco IOS-XE, IOS-XR, NX-OS, Arista EOS, Juniper JunOS). For other network operating systems, you will need `scrapli_community` or to use `GenericDriver`/`NetworkDriver` with custom privilege levels and on-open/on-close functions.
fix
For unsupported platforms, install `scrapli-community` (`pip install scrapli-community`) and import drivers from there, or use `from scrapli.driver.generic import GenericDriver` and define custom interaction logic.
affects: All
gotchaUsing Telnet as a transport requires explicit configuration. The default port is 22 (SSH), even if the Telnet driver is implicitly selected by an older method.
fix
When using Telnet, ensure you explicitly set `transport='telnet'` and `port=23` (or your custom Telnet port) in your device arguments.
affects: All
Upgrade
Version history
2026.2.20latest on PyPI · released Feb 20, 2026
Audit
Dependencies
PythonrequiredRuntime requirement
paramikooptionalOptional transport backend for SSH
ssh2-pythonoptionalOptional transport backend for SSH (wrapper around libssh2 for speed)
asyncsshoptionalOptional transport backend for asynchronous SSH
textfsmoptionalFor parsing command output using TextFSM templates (requires ntc-templates)
pyatsoptionalFor parsing command output using Cisco Genie (installs as 'pyats[library]')
lxmloptionalRequired by scrapli_netconf for XML parsing
scrapli_netconfoptionalProvides NETCONF client functionality built on scrapli core
scrapli_communityoptionalProvides drivers for additional network device platforms not in core scrapli
Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
scrapli — pip install scrapli · libregistry