Examples - Mikrotik Api
This library simplifies the low-level byte encoding.
Harnessing the MikroTik RouterOS API: Integration and Automation mikrotik api examples
while True: monitor = conn.path('interface', 'monitor-traffic').call( 'print', 'interface': 'ether1', 'once': '' ) for data in monitor: rx = data.get('rx-bits-per-second', 0) / 1_000_000 tx = data.get('tx-bits-per-second', 0) / 1_000_000 print(f"RX: rx:.2f Mbps, TX: tx:.2f Mbps") time.sleep(2) This library simplifies the low-level byte encoding
: Automatically update "walled garden" lists (allowed websites for unauthenticated users) based on specific marketing campaigns or schedules. 0) / 1_000_000 tx = data.get('tx-bits-per-second'
# 2. Add firewall accept rule for this IP api('/ip/firewall/filter/add', 'chain': 'forward', 'src-address': client_ip, 'action': 'accept', 'comment': client_name ) print("Firewall rule added")