File: async_iosxe_driver.py

package info (click to toggle)
python-scrapli 2023.7.30-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,512 kB
  • sloc: python: 14,451; makefile: 72
file content (25 lines) | stat: -rw-r--r-- 678 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""examples.async_usage.async_iosxe_driver"""
import asyncio

from scrapli.driver.core import AsyncIOSXEDriver

MY_DEVICE = {
    "host": "172.18.0.11",
    "auth_username": "scrapli",
    "auth_password": "scrapli",
    "auth_strict_key": False,
    "transport": "asyncssh",
}


async def main():
    """Simple example of connecting to an IOSXEDevice with the AsyncIOSXEDriver"""
    async with AsyncIOSXEDriver(**MY_DEVICE) as conn:
        # Platform drivers will auto-magically handle disabling paging for you
        result = await conn.send_command("show run")

    print(result.result)


if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main())