#!C:\Python36\python.exe # -*- coding: utf-8 -*- import json import random print("Content-Type: text/html") print("") A0 = str(random.choice([0,1])) A1 = str(random.choice([0,1])) A2 = str(random.choice([0,1])) A3 = str(random.choice([0,1])) A4 = str(random.choice([0,1])) A5 = str(0) A6 = str(random.choice([0,1])) A7 = str(random.choice([0,1])) bitmask = A0 + A1 + A2 + A3 + A4 + A5 + A6 + A7 JSON = { "AC": 218.8, "DC": 230.4, "in_cur": 48.0, "out_cur": 42.5, "in_freq": 50.0, "out_freq": 50.0, "pwr": 40.0, "line_fail": 1, "low_battery": 1, "bat_rem_cap": 92.0, "inner_temp": 27.0, "bat_time_left": 230.0, "bat_volt": 210, "bat_cap": 1200, "bat_exp": "12.12.2021", "case_temp": 36.0, "di1": "1", "di_name1": "Name1", "di2": "0", "di_name2": "Name2", "batsym": "Норма", "mode": "Профилактика сульфатации", "u_alarm": "5", "m_alarm": "0", "utc": "3.0", "netsettings_changed": "false" } print(json.dumps(JSON))