changed api default encoding to be in par with mikrotik winbox

This commit is contained in:
tomaae 2019-12-08 09:39:23 +01:00
parent daa20ca88b
commit 81aa8d0bd5
2 changed files with 8 additions and 1 deletions

View file

@ -9,3 +9,6 @@ CONF_SCAN_INTERVAL = "scan_interval"
DEFAULT_SCAN_INTERVAL = 30 DEFAULT_SCAN_INTERVAL = 30
CONF_TRACK_ARP = "track_arp" CONF_TRACK_ARP = "track_arp"
DEFAULT_TRACK_ARP = True DEFAULT_TRACK_ARP = True
DEFAULT_ENCODING = "ISO-8859-1"
DEFAULT_LOGIN_METHOD = "plain"

View file

@ -6,6 +6,10 @@ import os
import sys import sys
import importlib import importlib
from .exceptions import ApiEntryNotFound from .exceptions import ApiEntryNotFound
from .const import (
DEFAULT_LOGIN_METHOD,
DEFAULT_ENCODING,
)
MODULE_PATH = os.path.join(os.path.dirname(__file__), "librouteros", "__init__.py") MODULE_PATH = os.path.join(os.path.dirname(__file__), "librouteros", "__init__.py")
MODULE_NAME = "librouteros" MODULE_NAME = "librouteros"
@ -23,7 +27,7 @@ _LOGGER = logging.getLogger(__name__)
class MikrotikAPI: class MikrotikAPI:
"""Handle all communication with the Mikrotik API.""" """Handle all communication with the Mikrotik API."""
def __init__(self, host, username, password, port=0, use_ssl=True, login_method="plain", encoding="utf-8"): def __init__(self, host, username, password, port=0, use_ssl=True, login_method=DEFAULT_LOGIN_METHOD, encoding=DEFAULT_ENCODING):
"""Initialize the Mikrotik Client.""" """Initialize the Mikrotik Client."""
self._host = host self._host = host
self._use_ssl = use_ssl self._use_ssl = use_ssl