import pprint
import requests
from urllib3.exceptions import InsecureRequestWarning
HOST_NAME = "10.1.94.232"
SITE_NAME = "plugindev01"
API_URL = f"https://{HOST_NAME}/{SITE_NAME}/check_mk/api/1.0"
USERNAME = "automation"
PASSWORD = ""
# Disable SSL certificate verification warnings
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
session = requests.session()
session.headers['Authorization'] = f"Bearer {USERNAME} {PASSWORD}"
session.headers['Accept'] = 'application/json'
resp = session.get(
f"{API_URL}/domain-types/host/collections/all",
params={ # goes into query string
"query": '{"op": "=", "left": "name", "right": "CTS01"}', # An query expression of the Livestatus 'hosts' table in nested dictionary form.
"columns": ['mk_inventory'], # The desired columns of the `hosts` table.
},
verify=False
)
if resp.status_code == 200:
pprint.pprint(resp.json())
elif resp.status_code == 204:
print("Done")
else:
raise RuntimeError(pprint.pformat(resp))
This code can retrieve the regular columns that are string, time, int. but when i try retrieve blob or gzip it gives error
How can i update this code to work?