España

Trabajamos en colaboración con muchos distribuidores oficiales de Honda en todo el mundo.
Puede seleccionar el país de su elección en la siguiente lista. Sea cual sea su elección, ¡podemos enviárselo a cualquier parte del mundo!

Make sure /ip service set api-ssl disabled=no is enabled on the router. RouterOS 7.14 introduced REST API, but the classic API also works fine. For large networks, try async:

import ssl ssl_context = ssl.create_default_context() api_ssl = librouteros.connect( host='192.168.88.1', username='admin', password='', port=8729, use_ssl=True, ssl_wrapper=ssl_context )

leases = api(cmd='/ip/dhcp-server/lease/print') for lease in leases: if lease['comment'] == 'printer-api': print(f"Lease: {lease['address']} -> {lease['mac-address']}") Toggle a rule by comment (safer than index).

Board: RB750Gr3 Uptime: 3d5h12m CPU Load: 7% Automating DHCP reservations.

conns = api(cmd='/ip/firewall/connection/print') tcp_count = sum(1 for c in conns if c['protocol'] == 'tcp') udp_count = sum(1 for c in conns if c['protocol'] == 'udp')

Let me know in the comments. Want the code as a ready-to-use Python script? Download the gist here.

import asyncio from librouteros import connect async def get_interfaces(): loop = asyncio.get_event_loop() api = await loop.run_in_executor(None, connect, '192.168.88.1', 'admin', '') result = await loop.run_in_executor(None, api, '/interface/print') return result