brennerm / check-mk-web-api

Python library to talk to the Check_Mk Web API
https://brennerm.github.io/check-mk-web-api/
MIT License
53 stars 26 forks source link

set_hosttags failed to parse JSON request with special character & #16

Closed KNGP14 closed 4 years ago

KNGP14 commented 4 years ago

We have taggroup-titles with special characters like &.

Within the tags-dictionary there is a taggroup with "title": "Mail & Ansicht"

Exception: check_mk_web_api.exception.CheckMkWebApiException: Check_MK exception: Failed to parse JSON request: '{"tag_groups": [{"topi ... {"title": "Mail ': Unterminated string starting at: line 1 column 1778 (char 1777)

Workaround in check_mk_web_api/__init__.py:

@staticmethod
    def __build_request_data(data, request_format):
        ...
        # Workaround for special character &
        return request_string.replace('&', '%26').encode()
brennerm commented 4 years ago

Hey, thanks for reporting this issue and sorry for the late response.

Please try if the changes in the PR #17 fix your problem.

brennerm commented 4 years ago

Fixed with #17.