socialwifi / RouterOS-api

Python API to RouterBoard devices produced by MikroTik.
MIT License
251 stars 100 forks source link

How to handle the invalid User/Pass and Timeout error. #78

Open arash-87 opened 2 years ago

arash-87 commented 2 years ago

Hi guys,

How can we handle the timeout error occurring when a target machine is not available and customize the Python error?

As you can see on the screenshot, we face the python timeout error when a specific deadline passed but e a target machine is not answering or is inaccessible.

If we can handle the error with a customized error, that would be great. So any suggestion or turnaround?

image

arash-87 commented 2 years ago

OK, I have managed to handle the Timeout error and print a customized error using ping from os.system and an if statement before connection.get_api().

However, I cannot get my head around handling the error of facing the wrong user and password when connecting to a router with a customized error.