Scrapli for network automation: fast SSH and NETCONF connections in Python
In short: Scrapli is a Python library for connecting to network devices over SSH and Telnet, with a sister library for NETCONF. It is fast, supports both normal and asyncio code, and offers built-in drivers for Cisco IOS XE, NX-OS and IOS XR, Juniper Junos and Arista EOS. Its response objects can be parsed with TextFSM or Genie.
Why Scrapli?
Netmiko is the best-known SSH library for network devices. Scrapli takes a different design with a focus on speed and modern Python, including native asyncio support for connecting to many devices at once.
Installing and connecting
pip install scrapli
import os
from scrapli import Scrapli
device = {
"host": "10.0.0.1",
"auth_username": os.environ["NET_USER"],
"auth_password": os.environ["NET_PASS"],
"auth_strict_key": False,
"platform": "cisco_iosxe",
}
with Scrapli(**device) as conn:
response = conn.send_command("show version")
print(response.result)
Setting auth_strict_key to False skips SSH host key checking, which is fine in a lab; in production, manage known host keys properly.
Structured output
response = conn.send_command("show ip interface brief")
parsed = response.textfsm_parse_output()
for intf in parsed:
print(intf)
Use genie_parse_output() instead if pyATS and Genie are installed.
Configuration
result = conn.send_configs([
"interface Loopback100",
"description Managed by Scrapli",
])
print(result.failed)
Asyncio
Scrapli's async drivers (for example AsyncScrapli with the asyncssh transport) let one Python process handle many connections concurrently. This is useful for collecting data from hundreds of devices quickly.
NETCONF
The scrapli-netconf package provides NETCONF operations (get, get-config, edit-config, commit) with the same style.
Scrapli or Netmiko?
Choose Netmiko for the widest platform list and the largest community. Choose Scrapli for speed, asyncio and clean response objects, especially on its core platforms. Nornir has plugins for both.
Real-world example: faster data collection
A team's nightly script collected inventory from 1,200 devices one at a time and took over two hours. Rewriting it with Scrapli's async driver and a limit of 50 concurrent connections cut the run to under ten minutes.
Practice
Which Scrapli parameter selects the device type?
How can you parse Scrapli command output into structured data?
When might Scrapli be preferred over Netmiko?
Key takeaways
- Scrapli is a fast Python library for SSH and NETCONF to network devices.
- Core drivers cover IOS XE, NX-OS, IOS XR, Junos and EOS.
- Responses can be parsed with TextFSM or Genie.
- Async support helps when working with many devices.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.