mirror of
https://github.com/tomaae/homeassistant-mikrotik_router.git
synced 2025-07-10 01:14:33 +02:00
simplified api path call
This commit is contained in:
parent
df9f551b96
commit
fc74a2cd56
1 changed files with 2 additions and 4 deletions
|
@ -146,8 +146,7 @@ class MikrotikAPI:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
response = self._connection.path(path)
|
response = self._connection.path(path)
|
||||||
tmp = tuple(response)
|
_LOGGER.debug("API response (%s): %s", path, response)
|
||||||
_LOGGER.debug("API response (%s): %s", path, tmp)
|
|
||||||
except librouteros_custom.exceptions.ConnectionClosed:
|
except librouteros_custom.exceptions.ConnectionClosed:
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
_LOGGER.error("Mikrotik %s connection closed", self._host)
|
_LOGGER.error("Mikrotik %s connection closed", self._host)
|
||||||
|
@ -173,9 +172,8 @@ class MikrotikAPI:
|
||||||
_LOGGER.error("Mikrotik %s error while path %s", self._host, "unknown")
|
_LOGGER.error("Mikrotik %s error while path %s", self._host, "unknown")
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
return None
|
return None
|
||||||
else:
|
|
||||||
self.lock.release()
|
|
||||||
|
|
||||||
|
self.lock.release()
|
||||||
return response if response else None
|
return response if response else None
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue