Python SSH API for MikroTik devices

Hi guys!

I want to share with you an SSH API that I have made in Python and that I have freely published on GitHub.

For now there are a few basic functions available but I will be incorporating new features

Any suggestion is welcome :wink:

You can get the code by accessing the GitHub repository, downloading it from PyPI or by installing it directly on your machines using PIP with:

pip3 install routeros-ssh-connector

I hope you enjoy it!

Thanks for sharing, I hope someone can find it helpful

Hi guys,

There are new version of this API:

v1.6 Changelog

  • Added new method download_file


  • Updated download_backup, download_export and make_backup methods to optimize code:


  • Fixed make_backup method to set password parameter to None by default


  • Optimized get_routes method to allow to get more than 1000 routes.


  • Optimized connect method to handle connection exceptions

You can download it at GitHub or PyPI

To install directly on your host using PIP:

pip3 install routeros-ssh-connector

Hi guys,

There are new version of this API:

v1.7.1 Changelog
Added new “tool” methods:

  • configure_wlan that allows to configure 2.4GHz and 5GHz wlan interfaces
  • reboot_device to reboot your device
  • update_system to upgrade your RouterOS to latest version
  • upload_file to upload local files to your RouterOS device

You can download it at GitHub or PyPI

To install directly on your host using PIP:

pip3 install routeros-ssh-connector

I hope you enjoy it!

Your getters and setters are quite similar to Napalm (https://napalm.readthedocs.io/en/latest/base.html). You might want to see if there is some synergy between your work and theirs.

Hi MrYan,

Thanks for your comment! I know Napalm and i’m using it for automation tasks in our core network with Cisco and Huawei devices. Napalm is more oriented to network devices that supports “configuration states” like candidate, active, etc… Mikrotik doesn’t support it.

Another thing is that the Napalm module for Mikrotik only have implemented (at the moment) getters as they say in their GitHub module homepage but doesn’t allow configurations on device.

The main intention of my project is to serve an easy and friendly SSH API for MikroTik devices. It can be used from get some basic info from device or even in an automation scenario.

As i said at start, thanks for your comment! :wink:

Regards