socialwifi/RouterOS-api

How can you search for an unset value?

tal-zvon opened this issue · 1 comments

Trying to get the default route on the router in the main routing table.
Can't figure out how to tell .get() that I'm looking for an item where the routing_mark field is unset.

#!/usr/bin/env python3

import routeros_api

args = {
	"host": "1.2.3.4",
	"username": "admin",
	"password": "PASSWORD",
        ...
}

api_connection = routeros_api.RouterOsApiPool(**args)
api = api_connection.get_api()

routes = api.get_resource("/ip/route")
default_route = routes.get(dst_address="0.0.0.0/0", disabled="no", routing_mark=None)

None doesn't work. "none" doesn't seem to work either. Is there a way to do this?

resolve this is simple
just add 2 lines in resourse.py in class RouterOsBinaryResource(object):
sowhere around def set(self, **kwargs):

    def unset(self, **kwargs):
        return self.call('unset', kwargs)

it is like 'set' but calling "unset". working fine for me