diff --git a/routeros_api/sentence.py b/routeros_api/sentence.py index a146910..0664886 100644 --- a/routeros_api/sentence.py +++ b/routeros_api/sentence.py @@ -2,6 +2,7 @@ from routeros_api import exceptions from routeros_api import query +from six import string_types response_re = re.compile(b'^!(re|trap|fatal|done)$') @@ -56,6 +57,10 @@ def __init__(self, path, command, tag=None): def get_api_format(self): formated = [self.path + self.command] for key, value in self.attributes.items(): + if isinstance(key, string_types): + key = key.encode() + if isinstance(value, string_types): + value = value.encode() formated.append(b'=' + key + b'=' + value) for query in self.queries: formated.extend(query.get_api_format())