Como acessar a API RouterOS em Python usando a biblioteca 'routeros' (exemplo minimal)

Este exemplo usa a biblioteca routeros do PyPI (GitHub) para acessar a API MikroTik e extrair a identidade do sistema.

routeros_minimal_example.py
#!/usr/bin/env python3
from routeros import login

routeros = login('admin', 'abc123abc', '192.168.88.1')

output = routeros('/system/identity/print')
# Extract the one identity string from the list of dictionaries
print(output[0]['name'])

Check out similar posts by category: MikroTik Python