[Ruleset] Create new active HTTP check via API

In the meantime, I want to “patch” the ruleset with the help of python and then write it back.

So, I retrieve the data with PHP curl: ...&action=get_ruleset&output_format=python. POST request is {"ruleset_name":"active_checks:http"}.

That returns me: {'result_code': 0, 'result': {'ruleset': {'': [750629c9-6418-45ca-9201-d50874c6df30', 'value': {'name': 'osiris-owa', 'host': {.... the complete ruleset.

Then I want to read that to a helper python script to work with it:

#!/usr/bin/env python3

import sys
import ast

with open(sys.argv[1], "r") as data:
    dictionary = ast.literal_eval(data.read())


print(type(dictionary))
print(dictionary)

But all I get is:

Traceback (most recent call last):
  File "checkmk.py", line 7, in <module>
    dictionary = ast.literal_eval(data.read())
  File "/usr/lib/python3.6/ast.py", line 48, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.6/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 1
    {'result_code': 0, 'result': {'ruleset': {'': [75062...truncated...ons': {'description': 'AZS Zeitsystem SSL-Zertifikat'}}]}, 'configuration_hash': '2173901dfcd47611dbdc615914f44e2b'}}
                                                                                                                                                    ^
SyntaxError: invalid syntax

When I change the string, the ^ pointer moves as well, so its not a specific char imho.

Anyone you can assist me?