Skip to content

Telnet Connection Unsuccessful - Exception? #2299

Answered by ktbyers
rgourleypython asked this question in Q&A
Discussion options

You must be logged in to vote

Exceptions work for me as long as I specify the timeout. This is for a system that doesn't have telnet enabled:

from netmiko import ConnectHandler, BaseConnection
from getpass import getpass
import logging

host = "cisco.domain.io"
username = "admin"
password = getpass()

net_connect = ConnectHandler(
    host=host, username=username, password=password, device_type="generic_telnet", timeout=5
)
BaseConnection.telnet_login(net_connect)
print("-------")
print(net_connect.find_prompt())
print("-------")
$ python netmiko_simple.py 
Password: 
Traceback (most recent call last):
  File "netmiko_simple.py", line 9, in <module>
    net_connect = ConnectHandler(
  File "/home/kbyers/netmiko/netmik…

Replies: 4 comments 10 replies

Comment options

You must be logged in to vote
6 replies
@ktbyers
Comment options

@rgourleypython
Comment options

@ktbyers
Comment options

@rgourleypython
Comment options

@rgourleypython
Comment options

Comment options

You must be logged in to vote
1 reply
@rgourleypython
Comment options

Comment options

You must be logged in to vote
2 replies
@ktbyers
Comment options

@rgourleypython
Comment options

Comment options

You must be logged in to vote
1 reply
@rgourleypython
Comment options

Answer selected by ktbyers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants