Code: Select all
import routeros_api
connection = routeros_api.RouterOsApiPool('192.168.28.1', 'admin', 'goodpassword', plaintext_login=True)
api = connection.get_api()
nat_rules_api = api.get_resource('/ip/firewall/nat')
nat_rules = nat_rules_api.get()
print(nat_rules)
Code: Select all
import ros_api
connection = ros_api.Api('192.168.28.1', 'admin', 'goodpassword')
nat_rules = connection.talk('/ip/firewall/nat/print')
print(nat_rules)