added update value for mikrotik api

This commit is contained in:
tomaae 2019-12-03 01:47:38 +01:00
parent a4c4b344b7
commit a3e6e5692b
2 changed files with 28 additions and 0 deletions

View file

@ -116,3 +116,25 @@ class MikrotikAPI:
return None
return response if response else None
# ---------------------------
# update
# ---------------------------
def update(self, path, param, value, mod_param, mod_value):
response = self.path(path)
if response is None:
return False
for tmp in response:
if param not in tmp:
continue
if tmp[param] != value:
continue
params = {
'.id': tmp['.id'],
mod_param: mod_value
}
return response.update(**params)