getJson.cgi 1002 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!C:\Python36\python.exe
  2. # -*- coding: utf-8 -*-
  3. import json
  4. import random
  5. print("Content-Type: text/html")
  6. print("")
  7. A0 = str(random.choice([0,1]))
  8. A1 = str(random.choice([0,1]))
  9. A2 = str(random.choice([0,1]))
  10. A3 = str(random.choice([0,1]))
  11. A4 = str(random.choice([0,1]))
  12. A5 = str(0)
  13. A6 = str(random.choice([0,1]))
  14. A7 = str(random.choice([0,1]))
  15. bitmask = A0 + A1 + A2 + A3 + A4 + A5 + A6 + A7
  16. JSON = {
  17. "AC": 218.8,
  18. "DC": 230.4,
  19. "in_cur": 48.0,
  20. "out_cur": 42.5,
  21. "in_freq": 50.0,
  22. "out_freq": 50.0,
  23. "pwr": 40.0,
  24. "line_fail": 1,
  25. "low_battery": 1,
  26. "bat_rem_cap": 92.0,
  27. "inner_temp": 27.0,
  28. "bat_time_left": 230.0,
  29. "bat_volt": 210,
  30. "bat_cap": 1200,
  31. "bat_exp": "12.12.2021",
  32. "case_temp": 36.0,
  33. "di1": "1",
  34. "di_name1": "Name1",
  35. "di2": "0",
  36. "di_name2": "Name2",
  37. "batsym": "Норма",
  38. "mode": "Профилактика сульфатации",
  39. "u_alarm": "5",
  40. "m_alarm": "0",
  41. "utc": "3.0",
  42. "netsettings_changed": "false"
  43. }
  44. print(json.dumps(JSON))